Image processing method, electronic device and storage medium
By detecting the operation in the electronic device and obtaining the preview thumbnail from the preview buffer, the problem of image loss when the user switches or exits the camera application immediately after seeing the thumbnail is solved, and the captured image can be displayed in the camera or gallery application. functions, improving user experience and image quality.
Patent Information
- Application Number
- CN202311386020.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-03
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2043-07-03
AI Technical Summary
In electronic devices, when users switch the shooting mode of the camera application immediately after seeing the thumbnails or exit the camera application, the captured images may not be displayed in the gallery application, resulting in image loss, which affects the user experience.
By detecting the first and second operations, a preview thumbnail is generated, and when the image to be processed is not detected, the preview thumbnail is obtained from the preview buffer for processing, and the corresponding captured image is generated to ensure that the user even sees the preview thumbnail. Switch or exit the operation immediately, and you can also see the image taken this time in the camera or gallery application.
It effectively avoids the phenomenon of image loss, improves the user's shooting experience, and improves the quality of preview thumbnails and captured images during image processing.
Smart Images

Figure CN117528226B
Abstract
Description
[0001] This application is a divisional application of the Chinese patent application submitted to the State Intellectual Property Office on July 3, 2023, with application number 202310804341.3 and application name "A method for processing images, electronic device and storage medium". Technical Field
[0002] The present application relates to the field of computer technology, and in particular to a method for processing an image, an electronic device, and a storage medium. Background Art
[0003] With the rapid development of electronic technology, the penetration rate of electronic devices such as mobile phones and tablet computers is getting higher and higher, and with the development of camera functions in electronic devices, camera applications are being used more and more widely in electronic devices.
[0004] In the camera application, when the electronic device completes a shooting, a thumbnail image will be displayed in the shooting interface; usually the user regards the display of the thumbnail image by the electronic device as the end of a shooting. The image content in the thumbnail image is consistent with the image content of the actual shot this time, and the corresponding shot image stored in the gallery application can be found based on the thumbnail image.
[0005] At present, in order to improve the user shooting experience and make users feel that the shooting speed of electronic devices has been improved, the time of generating thumbnail images is advanced. Therefore, when the user sees the thumbnail image, if he immediately switches the shooting mode, enters the gallery application, or exits the camera application, the image generated by this shooting may not be displayed in the gallery application, that is, the image loss phenomenon occurs.
[0006] Therefore, how to avoid image loss has become an urgent problem to be solved. Summary of the invention
[0007] The present application provides an image processing method, an electronic device and a storage medium, which can avoid image loss and improve the user's shooting experience.
[0008] In a first aspect, the present application provides an image processing method, which is applied to an electronic device, and the method includes: when a first operation is detected, in response to the first operation, generating a preview thumbnail; displaying a first display interface including a thumbnail display area; detecting a second operation; in response to the second operation, if the image to be processed corresponding to the first captured image is not detected, obtaining a preview thumbnail; processing the preview thumbnail to generate a second captured image corresponding to the preview thumbnail.
[0009] The first operation is used to indicate a shooting operation, and the shooting operation may be a photo taking operation.
[0010] Optionally, the first operation may be a click operation on the shooting control; or, the first operation may be an operation of instructing shooting through voice; or, the first operation may be an operation of instructing shooting through face recognition; or, the first operation may be an operation of instructing shooting through gesture recognition; or, the first operation may be an operation of pressing a physical button (such as a volume button) to instruct shooting, etc.
[0011] The second operation is used to instruct switching of a shooting mode of the camera application, or to instruct exiting the camera application, or to instruct displaying a first shot image generated in response to the first operation.
[0012] The shooting modes of the camera application can include photo mode, portrait mode, selfie mode, HDR mode, super macro mode, high pixel mode, black and white art mode, etc.
[0013] The first display interface includes a thumbnail display area, shooting controls, etc., wherein a preview thumbnail is displayed in the thumbnail display area.
[0014] In this implementation, on the one hand, when the preview thumbnail is generated in advance, the user can see the captured image generated by this shooting in the camera application or gallery application even if the user switches the shooting mode of the camera application, views the captured image corresponding to the preview thumbnail, and exits the camera application immediately after seeing the preview thumbnail. This avoids the occurrence of image loss and also makes the user feel that the shooting speed of the electronic device has been improved, thereby enhancing the shooting experience.
[0015] On the other hand, since the algorithm processing time is increased during the image processing process, even if the user switches the shooting mode of the camera application immediately after seeing the preview thumbnail, views the captured image corresponding to the preview thumbnail, and exits the camera application, the user can still see the captured image generated by this shooting in the camera application or the gallery application, thus avoiding image loss and improving the quality of the preview thumbnail and the second captured image.
[0016] In a possible implementation, the first display interface also includes a thumbnail display control.
[0017] Optionally, when the second operation is used to instruct display of a first captured image generated in response to the first operation, the second operation includes clicking a thumbnail display control.
[0018] In this implementation, the first captured image generated based on the first operation can be quickly viewed by clicking the thumbnail display control, which increases the speed of viewing the first captured image and improves the user experience.
[0019] In a possible implementation, the method for processing an image provided in the present application further includes: detecting a third operation; and displaying the second captured image in a camera application or a gallery application in response to the third operation.
[0020] The third operation is used to indicate a click operation on a camera application or a gallery application.
[0021] It is worth mentioning that when the user wants to view the captured images in the camera application, he only needs to click the thumbnail display control once; when the user wants to view the captured images in the gallery application, he only needs to click the gallery application icon once, and usually he will see the thumbnail of the captured image. Click the thumbnail of the captured image again to see the second captured image displayed as a large image.
[0022] In this implementation, even if the user performs the third operation immediately after seeing the preview thumbnail, the user can still see the second captured image generated by this shooting in the camera application or the gallery application, thereby avoiding the loss of images and improving the shooting experience.
[0023] In one possible implementation, the electronic device includes a post-processing algorithm module, a camera service module and a camera hardware abstraction layer module, and the response to the second operation includes: the camera application initiates a termination acquisition instruction; the camera service module and the camera hardware abstraction layer module clear the current image processing link according to the termination acquisition instruction; the image processing link includes a link for generating an image to be processed; the post-processing algorithm module destroys the preview algorithm link, and the preview algorithm link includes a link for generating a preview thumbnail.
[0024] It is worth noting that when the preview algorithm link is destroyed, the preview thumbnails stored in the preview buffer will also be destroyed.
[0025] In this implementation, before destroying the preview algorithm link, it is detected whether the image to be processed is stored in the image buffer of the post-processing algorithm module, so that when the image to be processed is not detected in the image buffer, it is guaranteed that the preview thumbnail can be obtained from the preview buffer, thereby generating a second captured image based on the preview thumbnail.
[0026] In one possible implementation, the post-processing algorithm module includes an image buffer and a preview buffer, and the preview thumbnail is stored in the preview buffer; if the image to be processed corresponding to the first captured image is not detected, the preview thumbnail is obtained, including: before the post-processing algorithm module destroys the preview algorithm link, if the image to be processed is not detected in the image buffer, the preview thumbnail is obtained from the preview buffer.
[0027] In this implementation, before destroying the preview algorithm link, it is detected whether the image to be processed is stored in the image buffer of the post-processing algorithm module, so that when the image to be processed is not detected in the image buffer, it is guaranteed that the preview thumbnail can be obtained from the preview buffer, thereby generating a second captured image based on the preview thumbnail.
[0028] In a possible implementation, if the current shooting mode is any one of the photo mode, the portrait mode and the selfie mode, the image to be processed is not detected in the image buffer, including: one or more frames of the image to be processed are not detected in the image buffer.
[0029] In this implementation, different detection methods are selected for different shooting modes of the camera application. When one frame of image to be processed is needed to generate the first captured image, the first captured image is generated in time when one frame of image to be processed is detected, thereby improving the speed of generating the first captured image.
[0030] In a possible implementation, if the current shooting mode is the HDR mode, not detecting the image to be processed in the image buffer includes: not detecting multiple frames of the image to be processed in the image buffer.
[0031] In this implementation, different detection methods are selected for different shooting modes of the camera application to avoid generating the first captured image as soon as one frame of image to be processed is detected when at least two frames of image to be processed are required to generate the first captured image, thereby affecting the quality of the first captured image finally generated and giving a bad experience to the user.
[0032] In one possible implementation, the method for processing images provided in the present application also includes: creating a transmission link in the post-processing algorithm module and the camera hardware abstraction layer module; obtaining a preview thumbnail includes: the post-processing algorithm module uses the transmission link and the camera hardware abstraction layer module to obtain a preview thumbnail.
[0033] In a possible implementation, processing the preview thumbnail to generate a second captured image corresponding to the preview thumbnail includes: processing the preview thumbnail through a shooting algorithm link in a post-processing algorithm module to generate the second captured image.
[0034] In this implementation, the second captured image is generated by previewing the thumbnail, which effectively avoids the occurrence of image loss and improves the shooting experience.
[0035] In a possible implementation, before the third operation is detected, the method for processing an image provided by the present application further includes: the post-processing algorithm module sending the second captured image to a camera application and / or a gallery application.
[0036] In this implementation, the post-processing algorithm module sends the second captured image to the camera application and / or the gallery application, ensuring that the subsequent camera application and the gallery application can accurately and timely display the second captured image according to the user's third operation.
[0037] In a second aspect, the present application provides an electronic device, comprising: one or more processors; one or more memories; a module with multiple applications installed; the memory stores one or more programs, and when one or more programs are executed by the processor, the electronic device executes the method in the above-mentioned first aspect and any possible implementation thereof.
[0038] In a third aspect, the present application provides a chip, including a processor. The processor is used to read and execute a computer program stored in a memory to perform the method in the first aspect and any possible implementation thereof.
[0039] Optionally, the chip also includes a memory, and the memory is connected to the processor via a circuit or wire.
[0040] Optionally, the chip also includes a communication interface.
[0041] In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the processor executes the method in the first aspect and any possible implementation thereof.
[0042] In a fifth aspect, the present application provides a computer program product, which includes: a computer program code, which, when executed on an electronic device, enables the electronic device to execute the method in the first aspect and any possible implementation thereof.
[0043] The technical effects obtained by the above-mentioned second, third, fourth and fifth aspects are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of an application scenario for displaying thumbnail images shown in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of switching shooting modes shown in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of viewing a captured image shown in an embodiment of the present application;
[0047] Figure 4 This is a schematic diagram of another method of viewing a captured image according to an embodiment of the present application;
[0048] Figure 5 A schematic diagram of another method of viewing a captured image according to an embodiment of the present application;
[0049] Figure 6 A schematic diagram of another method of viewing a captured image according to an embodiment of the present application;
[0050] Figure 7 A schematic flowchart of a method for displaying a captured image according to an embodiment of the present application;
[0051] Figure 8 This is a schematic flowchart of a lost image scenario shown in an embodiment of the present application;
[0052] Fig. 9 This is a schematic diagram of the hardware structure of an electronic device shown as an exemplary embodiment of the present application;
[0053] Fig.10 A flowchart of a method for processing an image provided in an embodiment of the present application;
[0054] Fig.11 A flowchart of a specific implementation method of responding to a second operation provided in an embodiment of the present application;
[0055] Fig.12 A flowchart of another method for processing an image provided in an embodiment of the present application;
[0056] Fig.13 A flowchart of another method for processing an image provided in an embodiment of the present application;
[0057] Fig.14 A software structure block diagram of an electronic device shown as an exemplary embodiment of the present application;
[0058] Fig.15 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0060] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0061] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.
[0062] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0063] It should be noted that the method for processing images provided in the embodiments of the present application can be applied to any electronic device with a voice processing function.
[0064] In some embodiments of the present application, the electronic device may be a mobile phone, a smart screen, a tablet computer, a wearable device, a television, an in-vehicle electronic device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, etc., or may be other devices or apparatuses capable of scene recognition. The embodiments of the present application do not impose any restrictions on the specific type of the electronic device.
[0065] In order to better understand the method for processing an image provided in the embodiments of the present application, some terms involved in the embodiments of the present application are first explained below to facilitate understanding by those skilled in the art.
[0066] 1. Thumbnail images
[0067] A thumbnail image refers to an image with a smaller resolution cached in an electronic device. The image quality of a thumbnail image is lower than that of a captured image. Compared with a captured image in an electronic device, the resolution of a thumbnail image is smaller, and the display size of the thumbnail image is smaller than that of the captured image.
[0068] Optionally, by clicking on a thumbnail image of the shooting interface of the camera application, the actually shot image corresponding to the thumbnail image may be viewed.
[0069] 2. Image Buffer
[0070] In the embodiment of the present application, it is also called shooting Buffer, which can be regarded as a memory area for temporarily storing image data. It has enough capacity to store a complete frame of image data.
[0071] Optionally, once the image data is stored in the image buffer, the camera in the electronic device can subsequently process or save it.
[0072] 3. Preview Buffer
[0073] In the embodiment of the present application, it is also called preview Buffer, which can be regarded as a memory area in the camera for displaying the preview image in real time.
[0074] Before shooting, the electronic device usually displays images of the picture to be shot in the electronic device; these images showing the picture to be shot are called preview images; wherein, the electronic device can cache the preview images in a preview buffer.
[0075] 4. Buffer Rotation Mechanism
[0076] Buffer round-robin is a technique used to efficiently utilize and manage buffers in image processing.
[0077] The buffer rotation mechanism involves buffer queues, such as the capture buffer queue and the preview buffer queue; each buffer is placed back to the end of the queue after processing the image data, and then the next available buffer is obtained from the head of the queue, thus realizing the circular use of the buffer and avoiding frequent allocation and release operations.
[0078] 5.Raw domain
[0079] Also known as RAW Image Format, it refers to unprocessed images.
[0080] Raw images can be understood as the original data of a camera's photosensitive element, such as a complementary metal oxide semiconductor (CMOS) or a charge coupled device (CCD), which converts the captured light source signal into a digital signal.
[0081] The above is a brief introduction to the terms involved in the embodiments of the present application, which will not be repeated below.
[0082] With the rapid development of electronic technology, the penetration rate of electronic devices such as mobile phones and tablet computers is getting higher and higher, and with the development of camera functions in electronic devices, camera applications are being used more and more widely in electronic devices.
[0083] In camera applications, when an electronic device completes a shot, a thumbnail image will be displayed in the shooting interface; users usually regard the display of a thumbnail image by the electronic device as the end of a shot. Currently, in order to improve the user's shooting experience and make the user feel that the shooting speed of the electronic device has been improved, the time for generating thumbnail images is advanced, which may result in the failure to generate the corresponding captured image of the thumbnail image in time when the thumbnail image is generated. On the other hand, in order to improve the quality of the captured images generated by shooting, the algorithm processing time is increased during the image processing process, resulting in a delay in the generation of the captured image.
[0084] Therefore, when the user sees the thumbnail image, if he immediately switches the shooting mode of the camera application, views the captured image corresponding to the thumbnail image, and exits the camera application, the captured image generated by this shooting may not be displayed in the gallery application, that is, the image is lost.
[0085] It should be understood that thumbnail images of captured images are usually displayed in the gallery application. If the captured image is not generated within the time limit due to an abnormality in the electronic device, the thumbnail image corresponding to the captured image will be deleted from the gallery application. This is also a phenomenon of image loss.
[0086] In view of this, an embodiment of the present application provides a method for processing an image, which is applied to an electronic device, and the method includes: when a first operation is detected, in response to the first operation, generating a preview thumbnail, the first operation is used to indicate a shooting operation; displaying a first display interface including a thumbnail display area, the preview thumbnail is displayed in the thumbnail display area; detecting a second operation, the second operation is used to indicate switching of the shooting mode of a camera application, or to indicate exiting the camera application, or to indicate displaying a first captured image generated in response to the first operation; in response to the second operation, if the image to be processed corresponding to the first captured image is not detected, obtaining a preview thumbnail; processing the preview thumbnail to generate a second captured image corresponding to the preview thumbnail.
[0087] In this implementation, on the one hand, when the preview thumbnail is generated in advance, the user can see the captured image generated by this shooting in the camera application or gallery application even if the user switches the shooting mode of the camera application, views the captured image corresponding to the preview thumbnail, and exits the camera application immediately after seeing the preview thumbnail. This avoids the occurrence of image loss and also makes the user feel that the shooting speed of the electronic device has been improved, thereby enhancing the shooting experience.
[0088] On the other hand, since the algorithm processing time is increased during the image processing process, even if the user switches the shooting mode of the camera application immediately after seeing the preview thumbnail, views the captured image corresponding to the preview thumbnail, and exits the camera application, the user can still see the captured image generated by this shooting in the camera application or the gallery application, thus avoiding image loss and improving the quality of the preview thumbnail and the second captured image.
[0089] The following describes the application scenarios of the method for processing an image provided by an embodiment of the present application in conjunction with the accompanying drawings.
[0090] See also Figure 1 , Figure 1 A schematic diagram of an application scenario for displaying thumbnail images shown in an embodiment of the present application.
[0091] In the present application, the electronic device is described as a mobile phone. For example, after the electronic device runs the camera application, the preview interface 101 is displayed. Figure 1 As shown in (a) of FIG. 1 , the preview interface 101 may include a preview image, a thumbnail display control 102, and a shooting control 103. The thumbnail display control 102 is used to display a thumbnail image of the last shot.
[0092] For example, at the first moment, the electronic device detects the user clicking the shooting control 103. Figure 1 As shown in (b); at the second moment, the electronic device detects the user popping up the shooting control 103, and the electronic device displays the display interface 104, such as Figure 1 At this time, i.e., the moment when the user pops up the shooting control 103, the thumbnail image displayed in the thumbnail display control 102 displayed on the display interface 104 is still the thumbnail image of the image shot last time; at the third moment, the electronic device displays the display interface 105, and the thumbnail image displayed in the thumbnail display control 102 in the display interface 105 is the thumbnail image of the image shot this time, as shown in FIG. Figure 1 As shown in (d) in .
[0093] It should be understood that the third moment is later than the second moment, and the second moment is later than the first moment.
[0094] In one example, if the user switches the shooting mode of the camera application at the fourth moment, where the fourth moment is later than the third moment, and the time interval between the fourth moment and the third moment is long, so that the electronic device has enough time to generate the shooting image corresponding to the thumbnail image, then the shooting image generated by this shooting can be normally displayed in the gallery application. In other words, if the user switches the shooting mode of the camera application at the fourth moment, then the user can view the shooting image generated by this shooting in the gallery application at this time.
[0095] For easier understanding, see Figure 2 , Figure 2 A schematic diagram of switching shooting modes shown in an embodiment of the present application.
[0096] Exemplarily, at the third moment, the electronic device displays the display interface 201, the thumbnail image displayed in the thumbnail display control 202 in the display interface 201 is the thumbnail image of the image captured this time, and the current shooting mode is the photo mode, such as Figure 2 At the fourth moment, for example, the user clicks the "Professional" control in the display interface 201, as shown in (a). Figure 2 In response to the user clicking the "Professional" control, the electronic device switches the current shooting mode from the photo mode to the professional mode and displays the display interface 203, such as Figure 2 As shown in (c) in .
[0097] Since the fourth moment is later than the third moment and the time interval between the fourth moment and the third moment is long, the electronic device has enough time to generate the captured image corresponding to the thumbnail image, and the image loss phenomenon will not occur. In other words, if the user opens the gallery application at this time, the captured image generated by this shooting can be viewed in the gallery application.
[0098] In another example, if the user views the captured image corresponding to the thumbnail image at the fourth moment, since the electronic device has enough time to generate the captured image corresponding to the thumbnail image, the user can view the captured image generated by this shooting by clicking the thumbnail display control, or view the captured image generated by this shooting in the gallery application.
[0099] For easier understanding, see Figure 3 , Figure 3 A schematic diagram of viewing a captured image according to an embodiment of the present application.
[0100] Exemplarily, at the third moment, the electronic device displays the display interface 301, and the thumbnail image displayed in the thumbnail display control 302 in the display interface 301 is the thumbnail image of the image captured this time, such as Figure 3At the fourth moment, for example, the user clicks the thumbnail display control 302 in the display interface 301, as shown in (a). Figure 3 In response to the user clicking the thumbnail display control 302, the electronic device displays the captured image corresponding to the thumbnail image in the display interface 303, as shown in (b) in FIG. Figure 3 As shown in (c) in .
[0101] It should be understood that in this example, if the user opens a gallery application at this time, the captured images generated by this shooting can also be viewed in the gallery application.
[0102] In another example, if the user exits the camera application at the fourth moment, the electronic device has enough time to generate the captured image corresponding to the thumbnail image, so the captured image generated by this shooting can be normally displayed in the gallery application. In other words, if the user exits the camera application at the fourth moment, the user can view the captured image generated by this shooting in the gallery application at this time.
[0103] For easier understanding, see Figure 4 , Figure 4 This is a schematic diagram of another method of viewing captured images according to an embodiment of the present application.
[0104] Exemplarily, at the third moment, the electronic device displays the display interface 401, and the thumbnail image displayed in the thumbnail display control 402 in the display interface 401 is the thumbnail image of the image captured this time, such as Figure 4 At the fourth moment, for example, the user slides his finger upward from the bottom of the display interface 401, as shown in (a) in FIG. Figure 4 The electronic device responds to the user's sliding operation, exits the camera application and returns to the system desktop 403, as shown in (b) in FIG. Figure 4 The user clicks the gallery application icon 404 on the system desktop 403, and the electronic device responds to the user's click operation and displays the album interface 405, as shown in (c) in FIG. Figure 4 As shown in (d) in the figure. The album interface 405 displays the captured image 406 of this shooting, the captured image 407 of the last shooting, etc. It should be understood that the captured images 406, 407, etc. displayed in the album interface 405 are also displayed in the form of thumbnails. For example, when the user clicks on the captured image 406 again, the electronic device responds to the user's operation of clicking on the captured image 406 and displays the corresponding large image of the captured image 406 on the display interface, such as Figure 3 As shown in (c) in .
[0105] The above describes multiple application scenarios of capturing images corresponding to normal generation of thumbnail images. The following describes multiple application scenarios in which image loss occurs.
[0106] It should be understood that users usually regard the thumbnail image of the captured image displayed in the display interface as the completion of the shooting. Therefore, the time for generating the thumbnail image will be advanced. The time for users to switch the shooting mode of the camera application, view the captured image corresponding to the thumbnail image, and exit the camera application will also be advanced accordingly.
[0107] In one example, after the user sees the thumbnail image, he switches the shooting mode of the camera application at the fifth moment (immediately), wherein the fifth moment is later than the third moment, but the time interval between the fifth moment and the third moment is short, resulting in insufficient time for the electronic device to generate the shooting image corresponding to the thumbnail image, and the shooting image generated by this shooting cannot be displayed in the gallery application. In other words, if the user switches the shooting mode of the camera application at the fifth moment, the user cannot view the shooting image generated by this shooting in the gallery application at this time.
[0108] In another example, if the user attempts to view the captured image corresponding to the thumbnail image at the fifth moment, since the electronic device does not have enough time to generate the captured image corresponding to the thumbnail image, if the user clicks the thumbnail display control at this time, the captured image generated by this shooting cannot be viewed, or the captured image generated by this shooting cannot be viewed in the gallery application.
[0109] For easier understanding, see Figure 5 , Figure 5 This is a schematic diagram of another method of viewing a captured image according to an embodiment of the present application.
[0110] Exemplarily, at the third moment, the electronic device displays the display interface 501, and the thumbnail image displayed in the thumbnail display control 502 in the display interface 501 is the thumbnail image of the image captured this time, such as Figure 5 At the fifth moment, for example, the user clicks the thumbnail display control 502 in the display interface 501, as shown in (a). Figure 5 The electronic device responds to the user clicking the thumbnail display control 502, but because the user clicks the thumbnail display control 502 too quickly, the electronic device has not yet generated the captured image. Therefore, after the user clicks the thumbnail display control 502, the last captured image is displayed in the display interface 503, as shown in FIG. Figure 5 As shown in (c) in .
[0111] It should be understood that in this example, if the user opens the gallery application at this time, the captured image generated by this shooting cannot be viewed in the gallery application.
[0112] In another example, if the user exits the camera application at the fifth moment, the image generated by this shooting cannot be displayed in the gallery application because the electronic device does not have enough time to generate the image corresponding to the thumbnail image. In other words, if the user exits the camera application at the fifth moment, the user cannot view the image generated by this shooting in the gallery application at this time.
[0113] For easier understanding, see Figure 6 , Figure 6 This is a schematic diagram of another method of viewing captured images according to an embodiment of the present application.
[0114] Exemplarily, at the third moment, the electronic device displays the display interface 601, and the thumbnail image displayed in the thumbnail display control 602 in the display interface 601 is the thumbnail image of the image captured this time, such as Figure 6 At the fifth moment, for example, the user slides his finger upward from the bottom of the display interface 601, as shown in (a) of FIG. Figure 6 The electronic device responds to the user's sliding operation, exits the camera application and returns to the system desktop 603, as shown in (b) in FIG. Figure 6 As shown in (c) in FIG. 6 . The user clicks the gallery application icon 604 in the system desktop 603, and the electronic device responds to the user's click operation. Because the user exits the camera application too quickly, the electronic device has not yet generated the captured image. Therefore, the electronic device displays the album interface 605, as shown in FIG. Figure 6 As shown in (d) in the figure, the album interface 605 displays the last captured image 606, but does not display the current captured image.
[0115] In the above examples, since the time for generating thumbnail images is advanced, the time for users to switch the shooting mode of the camera application, view the captured images corresponding to the thumbnail images, and exit the camera application is also advanced. When the user switches the shooting mode of the camera application, views the captured images corresponding to the thumbnail images, and exits the camera application, the electronic device does not generate the captured images corresponding to the thumbnail images, resulting in the inability to display the captured images generated by this shooting in the gallery application, i.e., image loss occurs, which in turn causes a poor shooting experience for the user.
[0116] In an embodiment of the present application, a method for processing an image is provided; the method for processing an image provided according to the embodiment of the present application can solve the problem of occasional image loss in electronic devices, thereby improving the shooting experience.
[0117] The following describes the process of displaying captured images provided by the embodiment of the present application in conjunction with the accompanying drawings. It should be noted that the camera application and camera application described in the embodiment of the present application are just expressed in different ways, and both refer to the camera application in the electronic device; similarly, the gallery application and gallery application described in the embodiment of the present application are also expressed in different ways, and both refer to the gallery application in the electronic device.
[0118] See also Figure 7 , Figure 7 This is a schematic flow chart of a method for displaying a captured image according to an embodiment of the present application. The method is described in detail below.
[0119] S101: A user triggers a shooting operation.
[0120] Exemplarily, the shooting operation is used to indicate starting shooting, and the shooting operation may be a photo operation. Figure 1 As shown in (b) in FIG. 8 , the shooting operation may be a click operation on the shooting control 103 .
[0121] Optionally, in an embodiment of the present application, the above description is made by exemplifying the shooting operation as a click operation; in an embodiment of the present application, the shooting operation may also be an operation of shooting by voice instruction; or, the shooting operation may also be an operation of shooting by face recognition instruction; or, the shooting operation may also be an operation of shooting by gesture recognition instruction; or, the shooting operation may also be an operation of pressing a physical button (such as a volume button) to indicate shooting, etc.; the present application does not impose any limitation on this.
[0122] Optionally, a camera application may be run before S101.
[0123] For example, the user may instruct the electronic device to run a camera application by clicking the icon of the “Camera” application.
[0124] Exemplarily, when the electronic device is in a lock screen state, the user can instruct the electronic device to run a camera application by double-clicking the volume down button on the electronic device. Alternatively, when the electronic device is in a lock screen state, the lock screen interface includes an icon of a camera application, and the user instructs the electronic device to run the camera application by clicking the icon of the camera application. Alternatively, when the electronic device is running other applications, the other applications have the permission to call the camera application; the user can instruct the electronic device to run the camera application by clicking the corresponding control in the other application. For example, when the electronic device is running an instant messaging application, the user can instruct the electronic device to run the camera application by selecting the control of the camera function.
[0125] It should be understood that the above is an example of the operation of running a camera application; the operation can also be instructed by voice or other operations to instruct the electronic device to run the camera application; this application does not impose any limitation on this.
[0126] It should also be understood that running the camera application may refer to launching the camera application.
[0127] S102: The camera application responds to a shooting operation.
[0128] Exemplarily, the camera application starts shooting in response to various types of shooting operations triggered by the user.
[0129] It is worth noting that in the embodiments of the present application, when the shooting operation is a click operation, the shooting operation can be divided into an operation of clicking the shooting control and an operation of popping up the shooting control. Generally, when the camera application detects the operation of clicking the shooting control, shooting starts; when the camera application detects the operation of popping up the shooting control, shooting ends.
[0130] S103: The post-processing algorithm module captures the shooting request.
[0131] In the embodiment of the present application, the post-processing algorithm module may also be referred to as a service host framework (ServiceHost), and the post-processing algorithm module is arranged in the application framework layer (Framework) of the electronic device.
[0132] In an embodiment of the present application, the post-processing algorithm module is used to generate a preview thumbnail, a first captured image corresponding to the preview thumbnail, and a second captured image corresponding to the preview thumbnail.
[0133] Exemplarily, when responding to a shooting operation, the camera application creates a shooting request session and sends a shooting request to the post-processing algorithm module through the shooting request session; the post-processing algorithm module captures the shooting request sent by the camera application in real time.
[0134] Optionally, the post-processing algorithm module may perform some shooting preparation work after capturing the shooting request sent by the camera application.
[0135] S104: The camera application sends a shooting request to the camera service module.
[0136] The camera service module is the CameraService module, which is set in the application framework layer of the electronic device.
[0137] In an embodiment of the present application, the camera service module is used to receive information sent by the post-processing algorithm module and the camera application, or to transmit information to the post-processing algorithm module and the camera application.
[0138] It can be known from the above step S103 that the camera application creates a shooting request session when responding to the shooting operation; illustratively, the camera application can send a shooting request to the camera service module through the shooting request session.
[0139] S105: The camera service module captures a shooting request.
[0140] Exemplarily, the camera service module captures the shooting request sent by the camera application in real time.
[0141] Optionally, the camera service module is also used to transfer information to the camera hardware abstraction layer (CameraHAL) module. For example, after capturing a shooting request sent by the camera application, the camera service module can send the shooting request to the camera hardware abstraction layer module.
[0142] S106: The camera hardware abstraction layer module performs a first algorithm processing on the Raw image to obtain a first processing result.
[0143] An image sensor is provided in the electronic device, and the image sensor is used to collect raw image data to obtain a Raw image.
[0144] Exemplarily, the collected Raw image may be processed to convert the Raw image into a YUV image. It is understandable that the YUV image is the first processing result.
[0145] The first algorithm may include an algorithm for converting a Raw image into a YUV color space. For example, the first algorithm may be a Raw domain algorithm.
[0146] Specifically, a Raw domain algorithm may be used to process the Raw image to obtain a processed Raw image; wherein the Raw domain algorithm includes but is not limited to: black level correction processing, lens shading correction and other algorithms.
[0147] For example, black level correction is used to correct black level, which refers to the video signal level without a line of light output on a calibrated display device; the reason for black level correction is: on the one hand, due to the dark current of the image sensor, the pixel also has the problem of voltage output in the absence of light; on the other hand, due to the insufficient accuracy of the image sensor when performing analog-to-digital conversion. Lens Shading Correction (LSC) is used to eliminate the problem of inconsistent color and brightness around the image and the center of the image caused by the lens optical system.
[0148] The processed Raw image is converted into a YUV color space to obtain a YUV image; that is, the first processing result is obtained.
[0149] S107. The camera hardware abstraction layer module sends the first processing result to the camera service module.
[0150] A process is running in the camera service module, and the process can be used to capture the first processing result.
[0151] Exemplarily, the camera hardware abstraction layer module sends the first processing result to the camera service module, and the process running in the camera service module captures the first processing result, that is, captures the YUV image.
[0152] S108. The camera service module sends the first processing result to the post-processing algorithm module.
[0153] The post-processing algorithm module includes at least one image buffer, which can be used to store the YUV image, that is, to store the first processing result.
[0154] It should be understood that one image buffer can be used to store one complete YUV image frame, and multiple image buffers can be used to store multiple complete YUV images, and multiple image buffers constitute an image buffer queue.
[0155] Exemplarily, the camera hardware abstraction layer module sends the first processing result to the post-processing algorithm module, and the post-processing algorithm module stores the first processing result in the image buffer.
[0156] S109: The post-processing algorithm module performs a second algorithm processing on the first processing result to generate a first captured image.
[0157] The second algorithm includes an algorithm for converting a YUV image into an RGB image.
[0158] The post-processing algorithm module includes a shooting algorithm link, and the shooting algorithm link is used to process the first processing result, for example, perform a second algorithm processing on the first processing result to generate a first shot image.
[0159] Exemplarily, through the shooting algorithm link in the post-processing algorithm module, the second algorithm processing is performed on the first processing result, and the YUV image can be converted into an RGB image.
[0160] Optionally, the second algorithm may also include an algorithm for converting the YUV image into an image of another format. For example, the YUV image may be converted into an image of another format (e.g., JPEG format (JPG format), GIF format, DNG format, or RAW format, etc.) through a shooting algorithm link in a post-processing algorithm module.
[0161] It should be understood that the RGB image can be used to display on the display screen of the electronic device, such as Figure 3As shown in (c) in FIG. Images in other formats (eg, JPEG format (JPG format), GIF format, DNG format, or RAW format, etc.) can be used for storage, such as in an electronic device.
[0162] S110. The post-processing algorithm module sends the first captured image to a camera application.
[0163] Exemplarily, the post-processing algorithm module calls the first captured image to the camera application by monitoring the global event (onGlobalEvent) function. After the camera application obtains the first captured image, it can notify the gallery application to store, rename, etc. the first captured image.
[0164] S111. The camera application displays a first captured image.
[0165] The first captured image is displayed inside the camera application, but the first captured image is not displayed to the user for the time being. It can be generally understood that after the camera application obtains the first captured image, it has the ability to display the first captured image, but does not directly display the first captured image to the user.
[0166] Optionally, when a click operation of the user on the camera application is detected, the first captured image is displayed in the camera application in response to the click operation.
[0167] The process of generating the first captured image is described above through steps S101 to S111. It should be understood that a preview thumbnail corresponding to the first captured image will also be displayed in the preview interface of the camera application. Optionally, when executing the above step S104, steps S201 to S206 may also be executed, as follows:
[0168] S201: A camera application sends a preview request to a camera service module.
[0169] The camera application may send a preview request to the camera service module at the same time as sending a shooting request to the camera service module; or the camera application may first send a shooting request to the camera service module and then send a preview request to the camera service module.
[0170] Exemplarily, when responding to a shooting operation, the camera application may create a preview request session and send a preview request to the camera service module through the preview request session.
[0171] S202: The camera service module captures a preview request.
[0172] The camera service module captures the preview request sent by the camera application in real time, and then sends the preview request to the camera hardware abstraction layer module to trigger the image sensor in the electronic device to collect original image data and obtain a Raw image; the collected Raw image is processed and converted into a YUV image.
[0173] It is worth noting that the processing method used for the Raw image here is the same as the processing method used in the above step S106. Please refer to the description in the above step S106, which will not be repeated here.
[0174] In a possible implementation, the second processing result is a YUV image after the Raw image is converted.
[0175] In another possible implementation, the second processing result is a downsampled YUV image. For example, the Raw image is converted into a YUV image, and the YUV image is downsampled to obtain the downsampled YUV image; or, the Raw image may be downsampled to obtain a downsampled Raw image, and the format of the downsampled Raw image is converted to obtain the downsampled YUV image. This is only an exemplary description, and the present application does not impose any limitation on this.
[0176] S203: The camera hardware abstraction layer module sends the second processing result to the camera service module.
[0177] At least two processes are running in the camera service module, one process is used to capture the first processing result, and the other process is used to capture the second processing result.
[0178] Exemplarily, the camera hardware abstraction layer module sends the second processing result to the camera service module, and the process running in the camera service module captures the second processing result, that is, captures the YUV image.
[0179] S204: The camera service module sends the second processing result to the post-processing algorithm module.
[0180] The post-processing algorithm module includes at least one preview buffer, which can be used to store the second processing result.
[0181] It should be understood that one preview buffer can be used to store one complete frame of the second processing result, and multiple preview buffers can be used to store multiple complete frames of the second processing results, and multiple preview buffers constitute a preview buffer queue.
[0182] Exemplarily, the camera hardware abstraction layer module sends the second processing result to the post-processing algorithm module, and the post-processing algorithm module stores the second processing result in a preview buffer. For example, when the second processing result is a YUV image converted from a Raw image, a complete frame of the YUV image is stored in a preview buffer. For another example, when the second processing result is a downsampled YUV image, a complete frame of the downsampled YUV image is stored in a preview buffer.
[0183] It should be understood that when the second processing result is a downsampled YUV image, the downsampled YUV image is a preview thumbnail, and a complete frame of the downsampled YUV image is stored in a preview buffer, that is, a complete frame of the preview thumbnail is stored in a preview buffer.
[0184] S205: The camera application sends a preview thumbnail request to the post-processing algorithm module.
[0185] Exemplarily, the camera application may create a preview thumbnail request session, and send a preview thumbnail request to the post-processing algorithm module through the preview thumbnail request session; the post-processing algorithm module captures the preview thumbnail request sent by the camera application in real time.
[0186] S206: The post-processing algorithm module sends the preview thumbnail to the camera application.
[0187] In a possible implementation, when the second processing result is a downsampled YUV image, the downsampled YUV image is the preview thumbnail. At this time, after receiving the preview thumbnail request, the post-processing algorithm module can directly send the preview thumbnail to the camera application.
[0188] In another possible implementation, the post-processing algorithm module may further include a preview algorithm link, which includes a link for generating a preview thumbnail. When the second processing result is a YUV image converted from a Raw image, the converted YUV image is processed through the link for generating a preview thumbnail in the preview algorithm link to obtain a preview thumbnail. For example, the converted YUV image is downsampled through the link for generating a preview thumbnail in the preview algorithm link to obtain a preview thumbnail. After receiving the preview thumbnail request, the post-processing algorithm module sends the preview thumbnail to the camera application.
[0189] S207. The camera application updates the preview thumbnail.
[0190] It should be understood that the preview interface of the camera application originally displays a preview thumbnail of the last captured image, such as Figure 1As shown in (c) in FIG. 1 ; when a new preview thumbnail is generated, the preview thumbnail of the last captured image is replaced with the new preview thumbnail, as shown in FIG. 1 . Figure 1 As shown in (d) in the figure, the preview thumbnail is updated.
[0191] After a shooting session is completed, the user may have operations such as viewing the shot image or exiting the camera application. The above steps S201 to S206 describe the process of updating the preview thumbnail. The following describes the operations that the user may trigger after a shooting session is completed and the responses of the electronic device, as follows:
[0192] S301: The user triggers a second operation.
[0193] The second operation is used to instruct switching of a shooting mode of the camera application, or to instruct exiting the camera application, or to instruct displaying a first shot image generated in response to a shooting operation.
[0194] In a possible implementation, when the second operation is used to indicate switching the shooting mode of the camera application, the second operation may be clicking on other shooting modes of the camera application; wherein the other shooting modes are non-current shooting modes. Figure 2 As shown in (a) in FIG. 1 , the current shooting mode is the photo mode, and the second operation may be clicking on the professional mode of the camera application (the professional mode is another shooting mode, i.e., not the current shooting mode). Figure 2 As shown in (b) of FIG. 2 , the user clicks the “Professional” control in the display interface 201. In response to the user clicking the “Professional” control, the electronic device switches the current shooting mode from the photo mode to the professional mode, such as Figure 2 As shown in (c) in .
[0195] In another possible implementation, when the second operation is used to indicate exiting the camera application, the second operation may be an operation to exit the camera application; wherein the operation to exit the camera application may be an operation to exit the camera application through voice instructions; or, the operation to exit the camera application may also be a return operation; or, the operation to exit the camera application may also be an operation to open other applications, etc.; the present application does not impose any limitation on this.
[0196] like Figure 4 As shown in (b) of FIG. 4 , the user slides his finger upward from the bottom of the display interface 401. The electronic device responds to the user's sliding operation, exits the camera application and returns to the system desktop 403, as shown in FIG. Figure 4 As shown in (c) in .
[0197] In yet another possible implementation, when the second operation is used to instruct displaying a first captured image generated in response to a capturing operation, the second operation may be clicking on a thumbnail display control, or the second operation may be clicking on a gallery application.
[0198] like Figure 3 As shown in (b) of FIG. 3 , the user clicks the thumbnail display control 302 in the display interface 301; or Figure 4 As shown in (c) in FIG. 8 , the user clicks on the gallery application icon 404 in the system desktop 403 .
[0199] S302: The camera application sends a termination acquisition instruction to the camera service module.
[0200] Exemplarily, when the user triggers the second operation, the camera application detects the second operation triggered by the user and sends a termination acquisition instruction to the camera service module. The termination acquisition instruction is used for the camera service module and the camera hardware abstraction layer module to clear their respective current image processing links. The image sensor in the electronic device will no longer collect raw image data.
[0201] S303: The camera service module clears the current image processing link.
[0202] After receiving the termination acquisition instruction, the camera service module clears the image processing link in the current camera service module, which can be understood as clearing all tasks being executed in the current camera service module, or all tasks to be executed.
[0203] The image processing link includes a link for generating an image to be processed. In an embodiment of the present application, the link for generating an image to be processed to be cleared by the camera service module may be a link for capturing a shooting request, a link for capturing a preview request, a link for sending a first processing result to a post-processing algorithm module, a link for sending a second processing result to a post-processing algorithm module, etc.
[0204] S304: The camera hardware abstraction layer module clears the current image processing link.
[0205] After receiving the acquisition termination instruction, the camera hardware abstraction layer module clears the image processing link in the current camera hardware abstraction layer module, which can be understood as clearing all tasks being executed in the current camera hardware abstraction layer module, or all tasks to be executed.
[0206] The image processing link includes a link for generating an image to be processed. In an embodiment of the present application, the link for generating an image to be processed to be cleared by the camera hardware abstraction layer module may be a link for performing a first algorithm processing on a Raw image, a link for sending a first processing result to a camera service module, a link for sending a second processing result to a camera service module, etc.
[0207] S305: The camera application sends a destruction instruction to the post-processing algorithm module.
[0208] Exemplarily, the camera application releases the previously established session, such as the shooting request session, the preview request session, etc. At the same time, the camera application sends a destroy instruction to the post-processing algorithm module; wherein the destroy instruction is used to destroy the preview algorithm link.
[0209] S306: The post-processing algorithm module destroys the preview algorithm link.
[0210] Exemplarily, after receiving the destruction instruction sent by the camera application, the post-processing algorithm module destroys the preview algorithm link in the post-processing algorithm module, wherein the preview algorithm link includes a link for generating a preview thumbnail.
[0211] It is worth noting that when the preview algorithm link is destroyed, the preview thumbnails stored in the preview buffer will also be destroyed.
[0212] S401: View a first captured image.
[0213] Exemplarily, when the user wants to view the first captured image generated based on the current shooting operation, the user clicks on the camera application or the gallery application; the electronic device responds to the user's click operation and displays the first captured image in the camera application or the gallery application.
[0214] From the above process of displaying the captured image, it can be seen that the entire shooting process can be divided into four parts, as follows:
[0215] Part 1: Step S101 to Step S111, mainly describes the process of generating a first captured image after the user triggers the capture operation.
[0216] Part 2: Steps S201 to S207, mainly describe the process of the camera application updating the preview thumbnail.
[0217] Part 3: Steps S301 to S306, mainly describe the process of the user triggering the second operation and ending the shooting process.
[0218] Part 4: Step S401, mainly describes displaying the first captured image in the camera application or the gallery application.
[0219] In the second part, the camera application updates the preview thumbnail. When the user sees the preview thumbnail of the image shot this time in the display interface, the user usually considers that the shooting is completed. At this time, the user may perform the second operation in the third part to trigger the electronic device to execute the end shooting process. If the time of updating the preview thumbnail is normal, or the time of generating the preview thumbnail is normal, and the time when the user triggers the second operation is normal, then in the process of the electronic device executing the end shooting process, all the steps of the first part are executed, that is, the first shot image has been generated; after the electronic device executes the end shooting process, the user can still view the first shot image in the camera application or the gallery application in the fourth part.
[0220] It should be understood that in order to improve the user's shooting experience and make the user feel that the shooting speed of the electronic device has been improved, if the time for updating the preview thumbnail is advanced, or the time for generating the preview thumbnail is advanced, the time for the user to trigger the second operation will also be advanced (the user regards the display of the preview thumbnail in the display interface as the end of a shooting), resulting in that when the electronic device executes the end of the shooting process, all the steps of the first part have not been completed, that is, the first shot image has not been generated. In other words, the execution of steps S201 to S207 in the second part is advanced. When the user sees the preview thumbnail triggering the second operation, and the electronic device executes the end of the shooting process, steps S106 and S107 in the first part have not been completed, and step S304 in the third part needs to be executed, resulting in the inability to execute steps S107 to S109 in the first part, which ultimately leads to the phenomenon of image loss.
[0221] In layman's terms, the time to update the preview thumbnail is advanced, the time when the user triggers the second operation is advanced, and the process in the first part in which the camera hardware abstraction layer module performs the first algorithm processing on the Raw image and sends the first processing result (i.e., YUV image) to the camera service module has not been completed, so it is necessary to execute the process in the third part in which the camera hardware abstraction layer module clears the current image processing link. This results in the clearing of the process in the camera hardware abstraction layer module in which the first algorithm processing on the Raw image and the first processing result (i.e., YUV image) are sent to the camera service module, which in turn results in the first processing result (i.e., YUV image) being unable to be sent to the camera service module, and the camera service module being unable to send the first processing result (i.e., YUV image) to the post-processing algorithm module. The post-processing algorithm module does not receive the first processing result (i.e., YUV image), and therefore cannot generate the first captured image, resulting in the absence of the first captured image in the camera application, and image loss.
[0222] In addition to bringing forward the time for updating the preview thumbnail, in order to improve the quality of the captured image generated by shooting, the algorithm processing time is increased during the image processing process. For example, the processing time of step S106 in the first part is increased, so that a high-quality first processing result (i.e., a YUV image) can be obtained, but the increased processing time also causes a time delay in sending the first processing result (i.e., a YUV image) to the post-processing algorithm module, exacerbating the occurrence of image loss.
[0223] For easier understanding, see Figure 8 , Figure 8 This is a schematic flow chart of a lost image scenario shown in an embodiment of the present application. The specific description is as follows.
[0224] S101: A user triggers a shooting operation.
[0225] S102: The camera application responds to a shooting operation.
[0226] S103: The post-processing algorithm module captures the shooting request.
[0227] S104: The camera application sends a shooting request to the camera service module.
[0228] S105: The camera service module captures a shooting request.
[0229] S106: The camera hardware abstraction layer module performs a first algorithm processing on the Raw image to obtain a first processing result.
[0230] It is worth noting that when the above step S104 is executed, steps S201 to S207 can be executed.
[0231] S201: A camera application sends a preview request to a camera service module.
[0232] S202: The camera service module captures a preview request.
[0233] S203: The camera hardware abstraction layer module sends the second processing result to the camera service module.
[0234] S204: The camera service module sends the second processing result to the post-processing algorithm module.
[0235] S205: The camera application sends a preview thumbnail request to the post-processing algorithm module.
[0236] S206: The post-processing algorithm module sends the preview thumbnail to the camera application.
[0237] S207. The camera application updates the preview thumbnail.
[0238] It is worth noting that the process of updating the preview thumbnail is real-time, the speed of transmitting the second processing result is faster than the speed of transmitting the first processing result, and the user triggers the second operation after seeing the preview thumbnail, so the camera service module and the camera hardware abstraction layer module each clear the current image processing link, which has no effect on updating the preview thumbnail.
[0239] S301: The user triggers a second operation.
[0240] S302: The camera application sends a termination acquisition instruction to the camera service module.
[0241] S303: The camera service module clears the current image processing link.
[0242] S304: The camera hardware abstraction layer module clears the current image processing link.
[0243] S305: The camera application sends a destruction instruction to the post-processing algorithm module.
[0244] S306: The post-processing algorithm module destroys the preview algorithm link.
[0245] S401: Losing the first captured image.
[0246] For example, since the first captured image is not generated in time, the first captured image cannot be displayed in the camera application and the gallery application, and the user naturally cannot view the first captured image in the camera application and the gallery application, that is, the image is lost.
[0247] In an embodiment of the present application, a method for processing an image is provided; in response to a second operation, the method detects whether there is an image to be processed corresponding to the first captured image; if no image to be processed corresponding to the first captured image is detected, a preview thumbnail is obtained; the preview thumbnail is processed to generate a second captured image corresponding to the preview thumbnail. In this implementation, if it is detected that the captured image is lost in response to the second operation, the preview thumbnail is obtained, and the preview thumbnail is processed to generate a captured image, so that even if the user switches the shooting mode of the camera application, views the captured image corresponding to the preview thumbnail, and exits the camera application immediately after seeing the preview thumbnail, the captured image generated by this shooting can be seen in the camera application or the gallery application, thereby avoiding the phenomenon of image loss and improving the shooting experience.
[0248] The hardware structure of the electronic device involved in the embodiments of the present application is briefly introduced below with reference to the accompanying drawings.
[0249] In some embodiments of the present application, the electronic device may be a mobile phone, a tablet computer, a wearable device, a television, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., or may be other devices or apparatuses capable of performing scene recognition. The embodiments of the present application do not impose any restrictions on the specific type of the electronic device.
[0250] Please refer to Fig. 9 , Fig. 9 The figure is a schematic diagram of the hardware structure of an electronic device according to an exemplary embodiment of the present application.
[0251] like Fig. 9 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0252] It is to be understood that the structure shown in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include Figure 5 More or fewer components than those shown, or the electronic device 100 may include Figure 5 Combinations of some of the components shown, or the electronic device 100 may include Figure 5 Subassemblies of some of the components shown. Figure 5The components shown may be implemented in hardware, software, or a combination of software and hardware.
[0253] 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 processing unit (NPU), etc.
[0254] Among them, different processing units can be independent devices or integrated into one or more processors. Among them, the controller can be the nerve center and command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0255] 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.
[0256] In an embodiment of the present application, the processor 110 may perform the steps of detecting a first operation, generating a preview thumbnail in response to the first operation, the first operation being used to indicate a shooting operation; displaying a first display interface including a thumbnail display area, the preview thumbnail being displayed in the thumbnail display area; detecting a second operation, the second operation being used to indicate switching of the shooting mode of the camera application, or indicating exiting the camera application, or indicating displaying a first captured image generated in response to the first operation; in response to the second operation, if the image to be processed corresponding to the first captured image is not detected, obtaining a preview thumbnail; processing the preview thumbnail to generate a second captured image corresponding to the preview thumbnail. For example, the processor 110 may run the software code of the method for processing images provided in an embodiment of the present application, thereby solving the problem of occasional image loss in electronic devices, thereby improving the shooting experience.
[0257] 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) interface, a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0258] It is understandable that the interface connection relationship between the modules shown in this embodiment is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0259] The charging management module 140 is used to receive charging input from a charger. While the charging management module 140 is charging the battery 142 , it can also supply power to the electronic device 100 through the power management module 141 .
[0260] 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 external memory, the display screen 194, the camera 193, and the wireless communication module 160. In some other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be provided in the same device.
[0261] Fig. 9 The connection relationship between the modules shown is only a schematic illustration and does not constitute a limitation on the connection relationship between the modules of the electronic device 100. Optionally, the modules of the electronic device 100 may also adopt a combination of multiple connection modes in the above embodiments.
[0262] The wireless communication function of the electronic device 100 can be implemented through components such as the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
[0263] 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.
[0264] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 2G / 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 (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0265] 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.
[0266] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0267] 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 communications (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, etc. GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite based augmentation system (SBAS). It is understood that in the embodiments of the present application, the hardware module in the positioning or navigation system may be referred to as a positioning sensor.
[0268] The electronic device 100 can realize the display function through the GPU, the display screen 194 and the application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU can also be used to perform mathematical and posture calculations for graphics rendering, etc. The processor 110 may include one or more GPUs, which can generate or change display information by executing program instructions.
[0269] The display screen 194 can be used to display images or videos, and can also display a series of graphical user interfaces (GUIs), which are the main screens of the electronic device 100. Generally speaking, the size of the display screen 194 of the electronic device 100 is fixed, and only limited controls can be displayed on the display screen 194 of the electronic device 100. A control is a GUI element, which is a software component included in an application program, and controls all data processed by the application program and interactive operations on the data. Users can interact with the control through direct manipulation to read or edit relevant information of the application program. Generally speaking, a control can include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc.
[0270] In the embodiment of the present application, the display screen 194 can be used to display the display interface of the camera application, images in the gallery application, etc.
[0271] The display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N may be a positive integer greater than 1.
[0272] The display screen 194 in the embodiment of the present application may be a touch screen. A touch sensor 180K may be integrated in the display screen 194. The touch sensor 180K may also be referred to as a "touch panel". In other words, the display screen 194 may include a display panel and a touch panel, and the touch sensor 180K and the display screen 194 form a touch screen, also known as a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. After the touch operation detected by the touch sensor 180K, it can be passed to the upper layer by the driver of the kernel layer (such as the TP driver) to determine the type of touch event. Visual output related to the touch operation can be provided by the display screen 194. In other embodiments, the touch sensor 180K may also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0273] In an embodiment of the present application, the touch sensor 180K detects a user's touch operation. For example, when a user touches the display screen 194, the touch sensor 180K detects the user's touch operation, which is passed to the upper layer by the driver of the kernel layer (such as the TP driver) to determine the type of touch event, such as a click shooting control event. For another example, when the user no longer touches the display screen 194, the touch sensor 180K detects that the user lifts his finger, which is passed to the upper layer by the driver of the kernel layer (such as the TP driver) to determine the type of touch event, such as a pop-up shooting control event. In response to the user's touch operation, the processor 110 provides a visual output related to the touch operation through the display screen 194, such as the display screen 194 displays a display interface, and the display interface includes a preview image, a thumbnail display control, a thumbnail image displayed in the thumbnail display control, and a shooting control, etc.
[0274] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0275] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. 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 APP 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.
[0276] In addition, the internal memory 121 may include a high-speed random access memory; the internal memory 121 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.
[0277] 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. A 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 based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the touch position based on the detection signal of the pressure sensor 180A. In some embodiments, acting on different touch positions but different touch durations can correspond to different operation instructions.
[0278] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally the x-axis, y-axis and z-axis). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. The acceleration sensor 180E can also be used to identify the posture of the electronic device 100 as an input parameter for applications such as horizontal and vertical screen switching and pedometers.
[0279] 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.
[0280] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to realize functions such as unlocking, accessing application locks, taking photos, and answering calls.
[0281] 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.
[0282] 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.
[0283] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, message, missed call, notification, etc. The SIM card interface 195 is used to connect the SIM card. The SIM card may be connected to or disconnected from the electronic device 100 by inserting the SIM card interface 195 or pulling the SIM card interface 195 out. The electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 may support Nano SIM card, Micro SIM card, SIM card, etc.
[0284] In addition, various types of operating systems are running on the above components, such as Android system, IOS operating system, Symbian operating system, BlackBerry operating system, Linux operating system, Windows operating system, etc. This is only an exemplary description and is not limited to this. Different applications can be installed and run on these operating systems, such as any application that supports voice chat function.
[0285] The method for processing an image provided in the embodiment of the present application may be implemented in the electronic device 100 having the above-mentioned hardware structure.
[0286] The above briefly introduces the structure of the electronic device 100 involved in the embodiments of the present application. Fig. 9 Taking the electronic device with the structure shown as an example, the method for processing images provided in the embodiment of the present application is specifically described in combination with the accompanying drawings and application scenarios.
[0287] Before introducing the method for processing an image, it is hereby stated that the method for processing an image provided in the embodiment of the present application can be applied to any scenario where a captured image needs to be displayed immediately after a capture is completed.
[0288] See also Fig.10 , Fig.10 A flowchart of a method for processing an image provided in an embodiment of the present application. The method includes:
[0289] S11. When a first operation is detected, a preview thumbnail is generated in response to the first operation.
[0290] Exemplarily, the first operation is used to indicate a shooting operation, that is, to indicate to start shooting, and the first operation may be a photo shooting operation. Figure 1 As shown in (b) in FIG. 8 , the first operation may be a click operation on the shooting control 103 .
[0291] Optionally, in an embodiment of the present application, the above description is given by taking the first operation as a click operation as an example; in an embodiment of the present application, the first operation may also be an operation of shooting by voice instruction; or, the first operation may also be an operation of shooting by face recognition instruction; or, the first operation may also be an operation of shooting by gesture recognition instruction; or, the first operation may also be an operation of pressing a physical button (such as a volume button) to indicate shooting, etc.; the present application does not impose any limitation on this.
[0292] Exemplarily, after the camera application detects the first operation, it starts shooting in response to various types of first operations triggered by the user.
[0293] It is worth noting that in the embodiment of the present application, when the first operation is a click operation, the first operation can be divided into an operation of clicking a shooting control and an operation of popping up a shooting control. Generally, when the camera application detects an operation of clicking a shooting control, shooting starts; when the camera application detects an operation of popping up a shooting control, shooting ends.
[0294] Exemplarily, in response to the first operation, the camera application sends a preview request to the camera service module; the camera service module captures the preview request; the camera hardware abstraction layer module sends the second processing result to the camera service module; the camera service module sends the second processing result to the post-processing algorithm module; the post-processing algorithm module sends the preview thumbnail to the camera application; the camera application updates the preview thumbnail, i.e., generates a preview thumbnail.
[0295] It should be noted that the specific process of generating the preview thumbnail can refer to the description in the above steps S201 to S206, which will not be repeated here.
[0296] Optionally, after the preview thumbnail is generated, a copy of the preview thumbnail may be saved, for example, in a preview buffer in the post-processing algorithm module; or a cache module may be established in the post-processing algorithm module to save the copied preview thumbnail.
[0297] S12: Display a first display interface including a thumbnail display area.
[0298] Exemplarily, the first display interface is displayed in the camera application, such as Figure 1 As shown in (d) in the figure, the first display interface includes a thumbnail display area, a shooting control, etc. The thumbnail display area displays the preview thumbnail generated in step S11.
[0299] Optionally, the first display interface may also include a thumbnail display control.
[0300] S13: A second operation is detected.
[0301] The second operation is used to instruct switching of a shooting mode of the camera application, or to instruct exiting the camera application, or to instruct displaying a first shot image generated in response to the first operation.
[0302] In a possible implementation, when the second operation is used to indicate switching the shooting mode of the camera application, the second operation may be clicking on other shooting modes of the camera application; wherein the other shooting modes are non-current shooting modes. Figure 2 As shown in (a) in FIG. 1 , the current shooting mode is the photo mode, and the second operation may be clicking on the professional mode of the camera application (the professional mode is another shooting mode, i.e., not the current shooting mode). Figure 2 As shown in (b) of FIG. 2 , the user clicks the “Professional” control in the display interface 201. In response to the user clicking the “Professional” control, the electronic device switches the current shooting mode from the photo mode to the professional mode, such as Figure 2 As shown in (c) in .
[0303] In another possible implementation, when the second operation is used to indicate exiting the camera application, the second operation may be an operation to exit the camera application; wherein the operation to exit the camera application may be an operation to exit the camera application through voice instructions; or, the operation to exit the camera application may also be a return operation; or, the operation to exit the camera application may also be an operation to open other applications, etc.; the present application does not impose any limitation on this.
[0304] like Figure 4 As shown in (b) of FIG. 4 , the user slides his finger upward from the bottom of the display interface 401. The electronic device responds to the user's sliding operation, exits the camera application and returns to the system desktop 403, as shown in FIG. Figure 4 As shown in (c) in .
[0305] In yet another possible implementation, when the second operation is used to instruct displaying the first captured image generated in response to the first operation, the second operation may be clicking on a thumbnail display control, or the second operation may be clicking on a gallery application.
[0306] like Figure 3 As shown in (b) of FIG. 3 , the user clicks the thumbnail display control 302 in the display interface 301; or Figure 4 As shown in (c) in FIG. 8 , the user clicks on the gallery application icon 404 in the system desktop 403 .
[0307] S14: In response to the second operation, if the image to be processed corresponding to the first captured image is not detected, a preview thumbnail is obtained.
[0308] The image to be processed refers to an image used to generate the first captured image. For example, in the embodiment of the present application, the image to be processed may be a YUV image.
[0309] Exemplarily, in response to the second operation, it is detected whether the image to be processed is stored in the image buffer of the post-processing algorithm module. If the image to be processed is detected in the image buffer of the post-processing algorithm module, the second algorithm processing is performed on the image to be processed by the post-processing algorithm module to generate the first captured image. The process of performing the second algorithm processing on the image to be processed by the post-processing algorithm module can refer to the description of the above step S109, which will not be repeated here.
[0310] If the image to be processed is not detected in the image buffer of the post-processing algorithm module, then the first captured image cannot be generated based on the image to be processed, indicating that the image is lost. In this case, a preview thumbnail needs to be obtained. Specifically, a preview thumbnail that is copied and saved in advance is retrieved from the preview buffer of the post-processing algorithm module; or a preview thumbnail that is copied and saved in advance is retrieved from the cache module of the post-processing algorithm module.
[0311] Optionally, in a possible implementation, in response to the second operation, if the image to be processed is detected in the image buffer of the post-processing algorithm module, it is further detected whether the image to be processed is being processed by the second algorithm. If it is detected that the image to be processed is being processed by the second algorithm, the first captured image is waited to be generated. If it is detected that the image to be processed is not being processed by the second algorithm, the second algorithm is processed by the post-processing algorithm module to generate the first captured image; or, if it is detected that the image to be processed is not being processed by the second algorithm, a preview thumbnail is obtained. This can effectively avoid the phenomenon that the image to be processed is detected, but an accident occurs when the image to be processed is subsequently processed by the second algorithm, resulting in the failure to successfully generate the first captured image.
[0312] S15: Process the preview thumbnail to generate a second captured image corresponding to the preview thumbnail.
[0313] The post-processing algorithm module includes a shooting algorithm link, which transmits the preview thumbnail to the shooting algorithm link, processes the preview thumbnail through the shooting algorithm link, and generates a second shot image corresponding to the preview thumbnail. The processing of the preview thumbnail may include upsampling processing and image format conversion processing.
[0314] For example, the preview thumbnail is first upsampled through the shooting algorithm link to obtain an upsampled preview thumbnail, and then the upsampled preview thumbnail is converted into an RGB image to obtain the second shot image. For another example, the preview thumbnail is first converted into an RGB image through the shooting algorithm link, and then the RGB image is upsampled to obtain the second shot image.
[0315] It should be understood that the second captured image is generated based on the preview thumbnail, and the image quality of the preview thumbnail has been compressed, while the first captured image is generated based on the YUV image stored in the image buffer, and the image quality is not compressed, so the quality of the second captured image is not as high as the quality of the first captured image. However, compared to directly losing the first captured image, being able to display the second captured image in the camera application or the gallery application brings a better shooting experience to the user.
[0316] In an embodiment of the present application, when a first operation is detected, a preview thumbnail is generated in response to the first operation; a first display interface including a thumbnail display area is displayed; a second operation is detected, the second operation is used to indicate switching the shooting mode of the camera application, or to indicate exiting the camera application, or to indicate displaying the first captured image generated in response to the first operation; in response to the second operation, if the image to be processed corresponding to the first captured image is not detected, a preview thumbnail is obtained; the preview thumbnail is processed to generate a second captured image corresponding to the preview thumbnail. In this implementation, if it is detected that the captured image is lost in response to the second operation, a preview thumbnail is obtained, and the preview thumbnail is processed to generate a captured image, so that even if the user switches the shooting mode of the camera application, views the captured image corresponding to the preview thumbnail, and exits the camera application immediately after seeing the preview thumbnail, the user can still see the captured image generated by this shooting in the camera application or the gallery application, thereby avoiding the phenomenon of image loss and improving the shooting experience.
[0317] Optionally, in a possible implementation, the method for processing an image provided in the embodiment of the present application may further include, after step S15, steps S16 and S17, which are specifically as follows:
[0318] S16: A third operation is detected.
[0319] The third operation is used to indicate a click operation on a camera application or a gallery application.
[0320] Exemplarily, when the user wants to view the captured image generated based on the current shooting operation, the user clicks on the camera application or the gallery application; the electronic device responds to the user's click operation and displays the second captured image in the camera application or the gallery application.
[0321] It is worth mentioning that when the user wants to view the second captured image in the camera application, he only needs to click the thumbnail display control once; when the user wants to view the second captured image in the gallery application, he only needs to click the gallery application icon once, and what he usually sees is the thumbnail of the second captured image. Click the thumbnail of the second captured image again to see the second captured image displayed in a large image.
[0322] S17: In response to the third operation, display the second captured image in a camera application or a gallery application.
[0323] When the user wants to view the second captured image in the camera application, the user clicks the thumbnail display control in the display interface. The electronic device responds to the user's click of the thumbnail display control and displays the second captured image corresponding to the thumbnail image in a large image in the display interface.
[0324] When the user wants to view the second captured image in the gallery application, the user clicks the gallery application icon on the system desktop; the electronic device responds to the user's click operation and displays the album interface; the album interface displays the second captured image of this shooting, the captured image of the last shooting, etc. It should be understood that the second captured image displayed in the album interface at this time is also displayed in the form of a thumbnail. For example, when the user clicks the captured image of this shooting again, the electronic device responds to the user's operation of clicking the captured image and displays the second captured image as a large image on the display interface.
[0325] In this implementation, even if the user performs the third operation immediately after seeing the preview thumbnail, the user can still see the second captured image generated by this shooting in the camera application or the gallery application, thereby avoiding the loss of images and improving the shooting experience.
[0326] Optionally, in a possible implementation, the method for processing an image provided in an embodiment of the present application may further include, before detecting the third operation: the post-processing algorithm module sends the second captured image to a camera application and / or a gallery application.
[0327] For example, after the post-processing algorithm module processes the preview thumbnail and generates the second captured image, the second captured image can be transferred to the camera application and / or the gallery application by monitoring the global event (onGlobalEvent) function. The gallery application can store, rename, and perform other operations on the second captured image.
[0328] In this implementation, the post-processing algorithm module sends the second captured image to the camera application and / or the gallery application, ensuring that the subsequent camera application and the gallery application can accurately and timely display the second captured image according to the user's third operation.
[0329] Optionally, in a possible implementation, the specific implementation of responding to the second operation in the embodiment of the present application may include steps S21 to S23. Fig.11 , Fig.11 A flowchart of a specific implementation method for responding to a second operation provided in an embodiment of the present application.
[0330] S21. The camera application initiates a command to terminate acquisition.
[0331] Exemplarily, when the user triggers the second operation, the camera application detects the second operation triggered by the user and sends a termination acquisition instruction to the camera service module. The termination acquisition instruction is used for the camera service module and the camera hardware abstraction layer module to clear their respective current image processing links. The image sensor in the electronic device will no longer collect raw image data.
[0332] S22, the camera service module and the camera hardware abstraction layer module clear the current image processing link according to the termination acquisition instruction.
[0333] After receiving the termination acquisition instruction, the camera service module clears the image processing link in the current camera service module, which can be understood as clearing all tasks being executed in the current camera service module, or all tasks to be executed.
[0334] The image processing link includes a link for generating an image to be processed. In an embodiment of the present application, the link for generating an image to be processed to be cleared by the camera service module may be a link for capturing a shooting request, a link for capturing a preview request, a link for sending a first processing result to a post-processing algorithm module, a link for sending a second processing result to a post-processing algorithm module, etc.
[0335] After receiving the acquisition termination instruction, the camera hardware abstraction layer module clears the image processing link in the current camera hardware abstraction layer module, which can be understood as clearing all tasks being executed in the current camera hardware abstraction layer module, or all tasks to be executed.
[0336] The image processing link includes a link for generating an image to be processed. In an embodiment of the present application, the link for generating an image to be processed to be cleared by the camera hardware abstraction layer module may be a link for performing a first algorithm processing on a Raw image, a link for sending a first processing result to a camera service module, a link for sending a second processing result to a camera service module, etc.
[0337] Exemplarily, the camera application releases the previously established session, such as the shooting request session, the preview request session, etc. At the same time, the camera application sends a destroy instruction to the post-processing algorithm module; wherein the destroy instruction is used to destroy the preview algorithm link.
[0338] S23. The post-processing algorithm module destroys the preview algorithm link.
[0339] Exemplarily, after receiving the destruction instruction sent by the camera application, the post-processing algorithm module destroys the preview algorithm link in the post-processing algorithm module, wherein the preview algorithm link includes a link for generating a preview thumbnail.
[0340] It is worth noting that when the preview algorithm link is destroyed, the preview thumbnails stored in the preview buffer will also be destroyed.
[0341] In this implementation, the electronic device executes the end of the shooting process, releases each link in the shooting process, and prepares for the next shooting.
[0342] Since the preview algorithm link is destroyed, the preview thumbnail stored in the preview buffer will also be destroyed, and the preview thumbnail is required to generate the second captured image. Therefore, the method for processing an image provided in the embodiment of the present application requires the post-processing algorithm module to detect whether the image to be processed is stored in the image buffer of the post-processing algorithm module before destroying the preview algorithm link.
[0343] In a possible implementation, if an image to be processed is detected in the image buffer of the post-processing algorithm module, the post-processing algorithm module performs a second algorithm processing on the image to be processed to generate a first captured image.
[0344] In another possible implementation, if the image to be processed is not detected in the image buffer, a preview thumbnail is obtained from the preview buffer; the preview thumbnail is processed to generate a second captured image corresponding to the preview thumbnail.
[0345] In this implementation, before destroying the preview algorithm link, it is detected whether the image to be processed is stored in the image buffer of the post-processing algorithm module, so that when the image to be processed is not detected in the image buffer, it is guaranteed that the preview thumbnail can be obtained from the preview buffer, thereby generating a second captured image based on the preview thumbnail.
[0346] It should be understood that for different shooting modes of the camera application, the number of frames of the image to be processed required to generate the first captured image is different. For example, if the current shooting mode is any one of the photo mode, portrait mode and selfie mode, the first captured image can be generated based on one frame of the image to be processed. For another example, if the current shooting mode is any one of the professional mode, time-lapse shooting mode, panoramic mode and high dynamic range (HDR) mode, since these modes have high requirements on the quality of the generated first captured image, the first captured image is generated based on at least two frames of the image to be processed.
[0347] That is to say, when the first captured image can be generated normally, if the current shooting mode is any one of the photo mode, portrait mode and selfie mode, there is at least one frame of image to be processed in the image buffer. If the current shooting mode is the HDR mode, there are at least two frames of image to be processed in the image buffer.
[0348] Then, in the case where the first captured image cannot be generated, that is, the image to be processed is not detected in the image buffer, if the current shooting mode is any one of the photo mode, the portrait mode and the selfie mode, the image to be processed is not detected in the image buffer, including: one or more frames of the image to be processed are not detected in the image buffer. It can be understood that in this case, the image to be processed is not detected in the image buffer at all, and the first captured image cannot be generated according to the image to be processed.
[0349] If the current shooting mode is the HDR mode, the image to be processed is not detected in the image buffer, including: multiple frames of images to be processed are not detected in the image buffer. It can be understood that in this case, no image to be processed is detected in the image buffer at all, or one frame of image to be processed is detected in the image buffer, both of which belong to the situation that the image to be processed is not detected, because in these modes, the first captured image can be generated based on at least two frames of images to be processed.
[0350] It is worth noting that the above-mentioned different shooting modes corresponding to different frame numbers of images to be processed are only for exemplary purposes. The correspondence between different shooting modes and different frame numbers of images to be processed can be adjusted according to actual imaging requirements, and there is no limitation on this.
[0351] In this implementation, different detection methods are selected for different shooting modes of the camera application to avoid generating the first captured image as soon as one frame of image to be processed is detected when at least two frames of image to be processed are required to generate the first captured image, thereby affecting the quality of the first captured image finally generated and giving a bad experience to the user.
[0352] Optionally, in a possible implementation, the method for processing an image provided in the embodiment of the present application may further include step S31 and step S32. Fig.12 , Fig.12 A flowchart of another method for processing an image provided in an embodiment of the present application.
[0353] S31, creating a transfer link in the post-processing algorithm module and the camera hardware abstraction layer module.
[0354] S32, obtaining a preview thumbnail includes: the post-processing algorithm module obtains the preview thumbnail in the camera hardware abstraction layer module through a transmission link.
[0355] The preview thumbnail obtained in step S14 is first passed to the camera service module through the camera hardware abstraction layer module, then passed to the post-processing algorithm module by the camera service module, and finally obtained from the preview buffer of the post-processing algorithm module.
[0356] In this example, a transfer link can be created in advance between the post-processing algorithm module and the camera hardware abstraction layer module, and the post-processing algorithm module uses the transfer link and the camera hardware abstraction layer module to obtain a preview thumbnail. For example, the camera hardware abstraction layer module processes the Raw image using the first algorithm to obtain a YUV image; through the created transfer link, the camera hardware abstraction layer module sends the YUV image to the post-processing algorithm module; the post-processing algorithm module processes the YUV image, generates a preview thumbnail, and stores it in the preview buffer.
[0357] In other words, each frame of preview data obtained by the camera hardware abstraction layer module is transmitted to the post-processing algorithm module through the created transmission link for processing to obtain a preview thumbnail. The camera application sends a preview thumbnail request to the post-processing algorithm module, and the post-processing algorithm module sends the preview thumbnail to the camera application.
[0358] It should be understood that the shooting data can also be transmitted through the transmission link.
[0359] The process of processing the YUV image by the post-processing algorithm module can refer to the description in the above step S204, which will not be repeated here.
[0360] Optionally, after the preview thumbnail is generated, a copy of the preview thumbnail may be saved, for example, in a preview buffer in the post-processing algorithm module; or a cache module may be established in the post-processing algorithm module to save the copied preview thumbnail.
[0361] In this implementation, a transmission link is created in the post-processing algorithm module and the camera hardware abstraction layer module for obtaining a preview thumbnail based on the transmission link. Compared with the method of obtaining a preview thumbnail in step S14, this implementation reduces the number of data transmissions and improves the transmission efficiency, thereby increasing the speed of generating the second captured image and improving the shooting experience.
[0362] For easier understanding, see Fig.13 , Fig.13 A flowchart of another method for processing an image provided in an embodiment of the present application is as follows.
[0363] S501: A user triggers a shooting operation.
[0364] S502: The camera application responds to a shooting operation.
[0365] S503: The post-processing algorithm module captures the shooting request.
[0366] S504: The camera application sends a shooting request to the camera service module.
[0367] S505: The camera service module captures a shooting request.
[0368] S506: The camera hardware abstraction layer module performs a first algorithm processing on the Raw image to obtain a first processing result.
[0369] It is worth noting that when the above step S504 is executed, steps S601 to S606 can be executed.
[0370] For the description of steps S501 to S506 in the embodiment of the present application, reference may be made to the description of steps S101 to S106 described above, and will not be repeated here.
[0371] Optionally, when the camera hardware abstraction layer module performs the first algorithm processing on the Raw image, in addition to the processing performed in the above step S106, noise reduction processing, HDR processing, etc. may be added to the Raw image to obtain a high-quality first processing result, thereby improving the quality of subsequent preview thumbnails, first captured images, and second captured images.
[0372] S601: A camera application sends a preview request to a camera service module.
[0373] S602: The camera service module captures a preview request.
[0374] S603: The camera hardware abstraction layer module sends the second processing result to the camera service module.
[0375] S604: The camera service module sends the second processing result to the post-processing algorithm module.
[0376] S605: The camera application sends a preview thumbnail request to the post-processing algorithm module.
[0377] S606: The post-processing algorithm module sends the preview thumbnail to the camera application.
[0378] S607. The camera application updates the preview thumbnail.
[0379] For the description of steps S601 to S607 in the embodiment of the present application, reference may be made to the description of steps S201 to S207 described above, and will not be repeated here.
[0380] S701: The user triggers a second operation.
[0381] S702: The camera application sends a termination acquisition instruction to the camera service module.
[0382] S703: The camera service module clears the current image processing link.
[0383] S704: The camera hardware abstraction layer module clears the current image processing link.
[0384] S705: The camera application sends a destruction instruction to the post-processing algorithm module.
[0385] For the description of steps S701 to S705 in the embodiment of the present application, reference may be made to the description of steps S301 to S305 described above, and will not be repeated here.
[0386] S706: If the image to be processed corresponding to the first captured image is not detected, obtain a preview thumbnail.
[0387] Exemplarily, before the post-processing algorithm module destroys the preview algorithm link, it is detected whether the image buffer of the post-processing algorithm module stores an image to be processed.
[0388] In a possible implementation, if an image to be processed is detected in the image buffer of the post-processing algorithm module, the post-processing algorithm module performs a second algorithm processing on the image to be processed to generate a first captured image.
[0389] In another possible implementation, if no image to be processed is detected in the image buffer, a preview thumbnail is obtained from the preview buffer.
[0390] S707: Process the preview thumbnail to generate a second captured image corresponding to the preview thumbnail.
[0391] For the description of step S707 in the embodiment of the present application, reference may be made to the description of step S15 above, which will not be repeated here.
[0392] S708: The post-processing algorithm module sends the second captured image to the camera application.
[0393] Exemplarily, the post-processing algorithm module calls the second captured image to the camera application by monitoring the global event (onGlobalEvent) function. After the camera application obtains the second captured image, it can notify the gallery application to store, rename, etc. the second captured image.
[0394] S709: The camera application displays the second captured image.
[0395] The second captured image is displayed inside the camera application, and the second captured image is not displayed to the user for the time being. It can be generally understood that after the camera application obtains the second captured image, it has the ability to display the second captured image, but does not directly display the second captured image to the user.
[0396] Optionally, when a click operation of the user on the camera application is detected, the second captured image is displayed in the camera application in response to the click operation.
[0397] S710: The post-processing algorithm module destroys the preview algorithm link.
[0398] It should be understood that after the preview thumbnail is obtained in step S706, even if the preview algorithm link is destroyed, it has no effect on generating the second captured image. Therefore, step S710 can be executed at any time after step S706. This embodiment is only for exemplary description and is not limited to this.
[0399] S801: View a second captured image.
[0400] Exemplarily, when the user wants to view the captured image generated based on the current shooting operation, the user clicks on the camera application or the gallery application; the electronic device responds to the user's click operation and displays the second captured image in the camera application or the gallery application.
[0401] In an embodiment of the present application, when a first operation is detected, a preview thumbnail is generated in response to the first operation; a first display interface including a thumbnail display area is displayed; a second operation is detected, and the second operation is used to indicate switching of a shooting mode of a camera application, or to indicate exiting a camera application, or to indicate display of a first captured image generated in response to the first operation; in response to the second operation, if an image to be processed corresponding to the first captured image is not detected, a preview thumbnail is obtained; the preview thumbnail is processed to generate a second captured image corresponding to the preview thumbnail.
[0402] In this implementation, on the one hand, when the preview thumbnail is generated in advance, the user can see the captured image generated by this shooting in the camera application or gallery application even if the user switches the shooting mode of the camera application, views the captured image corresponding to the preview thumbnail, and exits the camera application immediately after seeing the preview thumbnail. This avoids the occurrence of image loss and also makes the user feel that the shooting speed of the electronic device has been improved, thereby enhancing the shooting experience.
[0403] On the other hand, since the algorithm processing time is increased during the image processing process, even if the user switches the shooting mode of the camera application immediately after seeing the preview thumbnail, views the captured image corresponding to the preview thumbnail, and exits the camera application, the user can still see the captured image generated by this shooting in the camera application or the gallery application, thus avoiding image loss and improving the quality of the preview thumbnail and the second captured image.
[0404] The following is a brief introduction to the software structure involved in the embodiment of this application. Fig.14 , Fig.14The software structure block diagram of an electronic device shown in an exemplary embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the electronic device 100 is an Android system as an example for explanation. The Android system is divided into three layers, from top to bottom, namely, the application layer, the application framework layer, and the camera hardware abstraction layer.
[0405] The application layer can include a series of application packages. Fig.14 As shown, the application package may include a camera application. The camera application may include a camera management (Camera Manager) module, a camera capture session (CameraCapture Session) module, and a camera device (Camera Device) module.
[0406] Among them, the camera management module is used to obtain camera characteristics, such as the number of cameras, shooting capabilities and other parameters.
[0407] Exemplarily, after the camera application is started, the camera management module is called to obtain camera characteristics, such as the number of cameras, shooting capabilities and other parameters, through the camera management module.
[0408] After the user triggers the shooting operation, the camera application responds to the shooting operation and creates a session in the camera device module through the camera capture session module, such as a shooting request session, a preview request session, a preview thumbnail request session, etc.
[0409] The application framework layer may include a camera service (CameraService) module, a camera device (Camera3Device) module, a camera output stream (CameraOutputStream) module, and a post-processing algorithm module.
[0410] The camera service module is a resident module, through which various information of the camera application can be read.
[0411] It is worth noting that the Camera3Device module is generated only when the camera application is in use, and is destroyed when the camera application stops using it. For example, when the camera application uses the front camera or the rear camera, the Camera3Device module will be generated, and when the camera stops using each camera, the Camera3Device module will be released. Exemplarily, a shooting request, a preview request, a preview thumbnail request, etc. are sent to the camera device module through the camera capture session module.
[0412] Optionally, the camera device (Camera3Device) module corresponds to the camera device (CameraDevice) module in the application layer.
[0413] Exemplarily, the camera capture session module sends a shooting request, a preview request, a preview thumbnail request, etc. to the camera device module; the camera device (Camera3Device) module passes the shooting request, the preview request, the preview thumbnail request, etc. to the camera hardware abstraction layer module in the camera hardware abstraction layer.
[0414] The camera output stream module is also generated when the camera application is used, and is used to transmit the first processing result and the second processing result to the post-processing algorithm module.
[0415] Optionally, when creating a session in a camera device module through a camera capture session module, the application framework layer creates a camera output stream module.
[0416] The camera hardware abstraction layer may include a camera hardware abstraction layer module and an image processing module.
[0417] The camera hardware abstraction layer module receives shooting requests, preview requests, preview thumbnail requests, etc., triggers the image sensor to collect raw image data, and thus obtains a Raw image.
[0418] In one example, the image processing module can process the collected Raw image and convert the Raw image into a YUV image. It can be understood that the YUV image is the first processing result. The first processing result is used to generate the first captured image.
[0419] In another example, the image processing module may process the collected Raw image to obtain a second processing result, wherein the second processing result is used to generate a preview thumbnail.
[0420] Exemplarily, the image processing module transmits the first processing result and the second processing result to the camera output stream module in the application framework layer, and the camera output stream module transmits the first processing result and the second processing result to the post-processing algorithm module.
[0421] The post-processing algorithm module may include a data source module, a diversion module, a detection module, a preview algorithm module, a preview module, a data transmission module, a shooting data source module, a shooting algorithm module, and a quick thumbnail module.
[0422] The data source module is used to receive the first processing result and the second processing result transmitted by the camera output stream module.
[0423] Optionally, in a possible implementation, the data source module transmits the second processing result to the diversion module. The diversion module copies the second processing result, transmits one copy of the second processing result to the detection module, and transmits another copy of the second processing result to the algorithm module.
[0424] The detection module is used to implement face detection, scene detection, brightness detection, gesture recognition, etc. For example, the face, scene, etc. in the second processing result are detected by the detection module.
[0425] Optionally, the detection module may send the detection result to the camera application, and the camera application displays the detection result in a preview interface.
[0426] The preview algorithm module may include a beautification algorithm for performing beautification processing on the second processing result to obtain an image that meets user needs.
[0427] Exemplarily, the preview algorithm module sends the second processing result after the beauty processing to the preview module. The preview module includes a preview algorithm link, and the preview algorithm link includes a link for generating a preview thumbnail. When the second processing result is a YUV image converted from a Raw image, the converted YUV image is processed through the link for generating a preview thumbnail in the preview algorithm link to obtain a preview thumbnail. For example, the converted YUV image is downsampled through the link for generating a preview thumbnail in the preview algorithm link to obtain a preview thumbnail.
[0428] Optionally, the preview module includes a preview buffer for storing preview thumbnails.
[0429] Optionally, after the preview thumbnail is generated, a copy of the preview thumbnail may be saved, for example, in a preview buffer; or a cache module may be established in the post-processing algorithm module to save the copied preview thumbnail.
[0430] Optionally, the camera application sends a preview thumbnail request to the preview module, the preview module sends the preview thumbnail to the camera application, and the camera application updates the preview thumbnail.
[0431] Optionally, in another possible implementation, the data source module transmits the first processing result to the data transmission module, and the data transmission module transmits the first processing result to the shooting data source module.
[0432] In one example, the shooting data source module sends the first processing result to the shooting module, and the shooting module includes a shooting algorithm link, which is used to process the first processing result to generate a first shot image. The specific processing process can refer to the description in the above step S109, which will not be repeated here.
[0433] Optionally, the shooting module sends the first shot image to a camera application, and then reference may be made to the descriptions in the above steps S110, S111 and S401, which will not be repeated here.
[0434] In another example, the photographing data source module sends the first processing result to the quick thumbnail module; the quick thumbnail module is used to process the first processing result and generate a quick thumbnail, such as Figure 4 The captured image 406 and the captured image 407 shown in (d) in FIG. 4 are shown in FIG. 4. Exemplarily, the fast thumbnail module performs downsampling processing on the first processing result to obtain a fast thumbnail corresponding to the first processing result.
[0435] Optionally, the quick thumbnail module sends the quick thumbnail to the camera application, so that the camera application displays the quick thumbnail in response to a user operation.
[0436] Optionally, when the user triggers the second operation, the camera application sends a termination acquisition instruction to the camera service module; the camera service module clears the current image processing link; the camera hardware abstraction layer module clears the current image processing link; the camera application sends a destruction instruction to the post-processing algorithm module. Before the post-processing algorithm module destroys the preview algorithm link, if the image to be processed corresponding to the first captured image is not detected, the preview thumbnail in the preview buffer is obtained. The preview thumbnail is processed by the shooting algorithm link in the shooting module to generate a second captured image corresponding to the preview thumbnail. The post-processing algorithm module sends the second captured image to the camera application. Please refer to the description in the above steps S708 to S710 and S801, which will not be repeated here.
[0437] In this implementation, on the one hand, when the preview thumbnail is generated in advance, the user can see the captured image generated by this shooting in the camera application or gallery application even if the user switches the shooting mode of the camera application, views the captured image corresponding to the preview thumbnail, and exits the camera application immediately after seeing the preview thumbnail. This avoids the occurrence of image loss and also makes the user feel that the shooting speed of the electronic device has been improved, thereby enhancing the shooting experience.
[0438] On the other hand, since the algorithm processing time is increased during the image processing process, even if the user switches the shooting mode of the camera application immediately after seeing the preview thumbnail, views the captured image corresponding to the preview thumbnail, and exits the camera application, the user can still see the captured image generated by this shooting in the camera application or the gallery application, thus avoiding image loss and improving the quality of the preview thumbnail and the second captured image.
[0439] The above describes in detail an example of a method for processing an image provided by an embodiment of the present application. It is understandable that, in order to implement the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to exceed the scope of the present application.
[0440] The embodiment of the present application can divide the functional modules of the electronic device according to the above method example. For example, each function can be divided into each functional module, or two or more functions can be integrated into one module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0441] It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0442] The electronic device provided in this embodiment is used to execute the above-mentioned method for processing an image, and thus can achieve the same effect as the above-mentioned implementation method.
[0443] In the case of an integrated unit, the electronic device may further include a processing module, a storage module and a communication module. The processing module may be used to control and manage the actions of the electronic device. The storage module may be used to support the electronic device to execute stored program codes and data, etc. The communication module may be used to support the electronic device to communicate with other devices.
[0444] Among them, the processing module can be a processor or a controller. It can implement or execute various exemplary logic boxes, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, a WiFi chip, etc.
[0445] In one embodiment, when the processing module is a processor and the storage module is a memory, the electronic device involved in this embodiment may be a Fig.14 Device of the structure shown.
[0446] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the processor executes the method for processing an image in any of the above embodiments.
[0447] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the method for processing an image in the above-mentioned embodiment.
[0448] The present application also provides a chip. Fig.15 , Fig.15 A schematic diagram of the structure of a chip provided in an embodiment of the present application. Fig.15 The chip shown can be a general-purpose processor or a dedicated processor. The chip includes a processor 210. The processor 210 is used to execute the method for processing an image in any of the above embodiments.
[0449] Optionally, the chip further includes a transceiver 220, which is used to accept control of the processor and to support the communication device in executing the technical solution shown above.
[0450] Optional, Fig.15 The chip shown may further include: a storage medium 230 .
[0451] It should be noted that Fig.15 The chip shown can be implemented using the following circuits or devices: one or more field programmable gate arrays (FPGAs), programmable logic devices (PLDs), controllers, state machines, gate logic, discrete hardware components, any other suitable circuits, or any combination of circuits that can perform the various functions described throughout this application.
[0452] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.
[0453] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0454] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0455] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0456] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0457] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0458] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for processing an image, characterized in that: Applied to electronic equipment, the method comprises: At a first moment, in response to a first operation, generating a first preview thumbnail; the first preview thumbnail is generated based on an image captured by a camera of the electronic device at the first moment; Displaying a first display interface including a thumbnail display area; the first preview thumbnail is displayed in the thumbnail display area; At a second moment, in response to a second operation, based on the fact that no first image to be processed is added to the image buffer after the first moment, a first captured image is generated according to the first preview thumbnail; the second operation includes an operation of switching a shooting mode of a camera application, an operation of exiting the camera application, or an operation of displaying an interface of a gallery application; At a third moment, in response to a third operation, a second display interface of the gallery application is displayed; the second display interface includes the first captured image.
2. The method according to claim 1, characterized in that The method further comprises: At a fourth moment, in response to the first operation, generating a second preview thumbnail; the second preview thumbnail is generated based on the image captured by the camera at the fourth moment; displaying a third display interface including a thumbnail display area, wherein the second preview thumbnail is displayed in the thumbnail display area of the third display interface; At a fifth moment, in response to the second operation, based on the fourth moment, a second image to be processed is added to the image buffer, and a second captured image is generated according to the second image to be processed; the resolution of the second captured image is greater than the resolution of the first captured image; At a sixth moment, in response to the third operation, a fourth display interface of the gallery application is displayed; the fourth display interface includes the second captured image.
3. The method according to claim 1, characterized in that The method further comprises: Before responding to the first operation, a first display interface including a thumbnail display area is displayed, the thumbnail display area of the first display interface displays a third preview thumbnail, and the third preview thumbnail is different from the first preview thumbnail.
4. The method according to claim 1, characterized in that The electronic device includes a post-processing algorithm module, a camera service module, and a camera hardware abstraction layer module, and responding to the second operation includes: The camera application initiates a command to terminate acquisition; The camera service module and the camera hardware abstraction layer module clear the current image processing link according to the termination acquisition instruction; the image processing link includes a link for generating the first image to be processed; The post-processing algorithm module destroys a preview algorithm link, wherein the preview algorithm link includes a link for generating the first preview thumbnail.
5. The method according to claim 4, characterized in that The post-processing algorithm module includes the image buffer and the preview buffer, and the first preview thumbnail is stored in the preview buffer; before generating the first captured image according to the first preview thumbnail, the method further includes: Before the post-processing algorithm module destroys the preview algorithm link, the first to-be-processed image is not added to the image buffer, and the first preview thumbnail is obtained from the preview buffer.
6. The method according to claim 4 or 5, characterized in that The method further comprises: Creating a transfer link between the post-processing algorithm module and the camera hardware abstraction layer module; The post-processing algorithm module uses the transmission link and the camera hardware abstraction layer module to obtain the first preview thumbnail.
7. The method according to claim 6, characterized in that The step of generating a first captured image according to the first preview thumbnail includes: The first preview thumbnail is processed by a shooting algorithm link in the post-processing algorithm module to generate the first shot image.
8. The method according to claim 1, characterized in that Before responding to the third operation, the method further includes: The post-processing algorithm module sends the first captured image to the gallery application.
9. An electronic device, characterized in that: include: one or more processors; one or more memories; The memory stores one or more programs, and when the one or more programs are executed by the processor, the electronic device executes the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Video processing method and electronic equipment
CN115002340A
Photographing method and electronic equipment
CN116055857A
