Camera switching method and device, electronic equipment and computer readable storage medium
By compressing and fusing the images captured by the second camera during camera switching, the problems of image stuttering and abrupt changes during camera switching are solved, achieving a smooth camera switching effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2022-01-20
- Publication Date
- 2026-07-07
AI Technical Summary
During camera switching, the image may experience stuttering or abrupt changes.
The first camera is used as the main camera to acquire images and obtain a first original image. During the current magnification adjustment process, the second camera is used to acquire images and obtain a second original image. The second original image is compressed to obtain an original compressed image, which is then fused with the first original image. Based on the fusion result, the image acquired by the second camera is further compressed until the magnification meets the switching conditions, at which point the second camera is switched to the main camera.
It enables smooth switching of image data streams from different cameras, avoiding image jumps or stuttering, and ensuring the continuity of image data in terms of field of view and effect.
Smart Images

Figure CN116506742B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of imaging technology, and in particular to a camera switching method, apparatus, electronic device, computer-readable storage medium, and computer program product. Background Technology
[0002] With the development of imaging technology, electronic devices often have multiple cameras for shooting. Generally, the operation page of a multi-camera camera will have focal length switching options of 0.6x, 1x, 2x or 5x, 10x. The smaller the number, the wider the field of view, and the larger the number, the farther the field of view, which corresponds to the focal length of ultra-wide-angle, wide-angle and telephoto lenses.
[0003] When users take photos with a camera, they often switch between the cameras based on the current scene, such as switching from a wide-angle camera to a telephoto camera. However, minimizing image distortion during zooming is a key issue that needs to be addressed. Summary of the Invention
[0004] This application provides a camera switching method, apparatus, electronic device, and computer-readable storage medium, which can effectively reduce image stuttering or abrupt changes caused by camera switching.
[0005] A camera switching method, comprising:
[0006] The first original image is obtained by capturing images using the first camera as the main camera;
[0007] During the current magnification adjustment process, images are captured through a second camera to obtain a second original image;
[0008] The second original image is compressed to obtain an original compressed image, and the original compressed image and the first original image are fused to obtain a fusion result;
[0009] Based on the fusion result, the second intermediate image captured by the second camera is compressed to obtain an intermediate compressed image;
[0010] The intermediate compressed image is used as the original compressed image for the next round, and the first intermediate image captured by the first camera is used as the first original image for the next round. The process of fusing the original compressed image and the first original image is returned and continued until the magnification during the adjustment process meets the switching conditions. Then, the second camera is switched to the main camera.
[0011] A camera switching device, comprising:
[0012] The first acquisition module is used to acquire images using the first camera as the main camera to obtain a first original image;
[0013] The second acquisition module is used to acquire images through the second camera during the current magnification adjustment process to obtain a second original image;
[0014] The fusion module is used to compress the second original image to obtain an original compressed image, and then fuse the original compressed image and the first original image to obtain a fusion result.
[0015] The compression module is used to compress the second intermediate image captured by the second camera based on the fusion result to obtain an intermediate compressed image;
[0016] The switching module is used to use the intermediate compressed image as the original compressed image for the next round, use the first intermediate image captured by the first camera as the first original image for the next round, and return to the step of fusing the original compressed image and the first original image and continue to execute until the magnification in the adjustment process meets the switching condition, and then switch the second camera to the main camera.
[0017] An electronic device includes a memory and a processor, wherein the memory stores a computer program, characterized in that, when the computer program is executed by the processor, the processor causes the processor to perform the following steps:
[0018] The first original image is obtained by capturing images using the first camera as the main camera;
[0019] During the current magnification adjustment process, images are captured through a second camera to obtain a second original image;
[0020] The second original image is compressed to obtain an original compressed image, and the original compressed image and the first original image are fused to obtain a fusion result;
[0021] Based on the fusion result, the second intermediate image captured by the second camera is compressed to obtain an intermediate compressed image;
[0022] The intermediate compressed image is used as the original compressed image for the next round, and the first intermediate image captured by the first camera is used as the first original image for the next round. The process of fusing the original compressed image and the first original image is returned and continued until the magnification during the adjustment process meets the switching conditions. Then, the second camera is switched to the main camera.
[0023] A computer-readable storage medium having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0024] The first original image is obtained by capturing images using the first camera as the main camera;
[0025] During the current magnification adjustment process, images are captured through a second camera to obtain a second original image;
[0026] The second original image is compressed to obtain an original compressed image, and the original compressed image and the first original image are fused to obtain a fusion result;
[0027] Based on the fusion result, the second intermediate image captured by the second camera is compressed to obtain an intermediate compressed image;
[0028] The intermediate compressed image is used as the original compressed image for the next round, and the first intermediate image captured by the first camera is used as the first original image for the next round. The process of fusing the original compressed image and the first original image is returned and continued until the magnification during the adjustment process meets the switching conditions. Then, the second camera is switched to the main camera.
[0029] A computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0030] The first original image is obtained by capturing images using the first camera as the main camera;
[0031] During the current magnification adjustment process, images are captured through a second camera to obtain a second original image;
[0032] The second original image is compressed to obtain an original compressed image, and the original compressed image and the first original image are fused to obtain a fusion result;
[0033] Based on the fusion result, the second intermediate image captured by the second camera is compressed to obtain an intermediate compressed image;
[0034] The intermediate compressed image is used as the original compressed image for the next round, and the first intermediate image captured by the first camera is used as the first original image for the next round. The process of fusing the original compressed image and the first original image is returned and continued until the magnification during the adjustment process meets the switching conditions. Then, the second camera is switched to the main camera.
[0035] The aforementioned camera switching method, apparatus, electronic device, computer-readable storage medium, and computer program product acquire images using a first camera as the main camera to obtain a first original image. During the current magnification adjustment process, an image is acquired using a second camera to obtain a second original image. The second original image is compressed to obtain a compressed original image. The compressed original image and the first original image are then fused to obtain a fused result, ensuring consistency in field of view and effect between the two images. Based on the fused result, the second intermediate image acquired by the second camera is compressed to obtain an intermediate compressed image. This reduces the amount of image data transmitted by the second camera, preventing image data interruptions due to low bandwidth limitations and ensuring normal image data transmission. The intermediate compressed image is used as the original compressed image for the next round, and the first intermediate image acquired by the first camera is used as the first original image for the next round. The process then returns to the step of fusing the compressed original image and the first original image, continuing until the magnification during the adjustment process meets the switching conditions. At this point, the second camera is switched to the main camera. This effectively achieves smooth switching of image data streams from different cameras, avoiding image jumps or stuttering, thus realizing smooth camera switching. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is a schematic diagram of the image processing circuit of an electronic device in one embodiment;
[0038] Figure 2 Here is a flowchart of a camera switching method in one embodiment;
[0039] Figure 3 This is a flowchart illustrating the compression and space alignment processes in one embodiment;
[0040] Figure 4 This is a schematic diagram illustrating the changes in the main area in one embodiment;
[0041] Figure 5 A flowchart of a camera switching method in another embodiment;
[0042] Figure 6 This is a structural block diagram of a camera switching device in one embodiment;
[0043] Figure 7This is a block diagram of the internal structure of an electronic device in one embodiment. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0045] The camera switching method in this application embodiment can be applied to electronic devices. These electronic devices can be computer devices, personal digital assistants, tablet computers, smartphones, wearable devices, etc., equipped with at least one camera.
[0046] In one embodiment, the above-described electronic device may include an image processing circuit, which may be implemented using hardware and / or software components and may include various processing units that define the ISP (Image Signal Processing) pipeline. Figure 1 This is a schematic diagram of an image processing circuit in one embodiment. For example... Figure 1 As shown, for ease of explanation, only aspects of the image processing technology related to the embodiments of this application are shown.
[0047] like Figure 1 As shown, an image processing circuit for an electronic device with at least two cameras is provided. The image processing circuit includes a first ISP processor 130, a second ISP processor 140, and a control logic unit 150. The first camera 110 includes one or more first lenses 112 and a first image sensor 114. The first image sensor 114 may include a color filter array (such as a Bayer filter), and can acquire light intensity and wavelength information captured by each imaging pixel of the first image sensor 114, providing a set of image data that can be processed by the first ISP processor 130. The second camera 120 includes one or more second lenses 122 and a second image sensor 124. The second image sensor 124 may include a color filter array (such as a Bayer filter), and can acquire light intensity and wavelength information captured by each imaging pixel of the second image sensor 124, providing a set of image data that can be processed by the second ISP processor 140.
[0048] The first raw image captured by the first camera 110 is transmitted to the first ISP processor 130 for processing. After processing the first raw image, the first ISP processor 130 can send statistical data of the first image (such as image brightness, image contrast, image color, etc.) to the control logic unit 150. The control logic unit 150 can determine the control parameters of the first camera 110 based on the statistical data, so that the first camera 110 can perform operations such as automatic focusing and automatic exposure according to the control parameters. After being processed by the first ISP processor 130, the first raw image can be stored in the image memory 160. The first ISP processor 130 can also read the images stored in the image memory 160 for further processing. In addition, after being processed by the ISP processor 130, the first raw image can be directly sent to the display 170 for display. The display 170 can also read the images in the image memory 160 for display.
[0049] The first ISP processor 130 processes image data pixel by pixel in various formats. For example, each image pixel may have a bit depth of 8, 10, 12, or 14 bits. The first ISP processor 130 may perform one or more image processing operations on the image data and collect statistical information about the image data. The image processing operations may be performed with the same or different bit depth precision.
[0050] Image memory 160 may be part of a memory device, a storage device, or a separate dedicated memory within an electronic device, and may include DMA (Direct Memory Access) features.
[0051] Upon receiving image data from the interface of the first image sensor 114, the first ISP processor 130 may perform one or more image processing operations, such as temporal filtering. The processed image data may be sent to the image memory 160 for further processing before display. The first ISP processor 130 receives processed data from the image memory 160 and performs image data processing in the RGB and YCbCr color spaces. The processed image data may be output to the display 170 for user viewing and / or further processed by a graphics engine or GPU (Graphics Processing Unit). Furthermore, the output of the first ISP processor 130 may also be sent to the image memory 160, and the display 170 may read image data from the image memory 160. In one embodiment, the image memory 160 may be configured to implement one or more frame buffers.
[0052] The statistical data determined by the first ISP processor 130 may be sent to the control logic unit 150. For example, the statistical data may include statistics from the first image sensor 114, such as automatic exposure, automatic white balance, automatic focus, flicker detection, black level compensation, and shadow correction of the first lens 112. The control logic unit 150 may include a processor and / or microcontroller executing one or more routines (such as firmware) that determine control parameters for the first camera 110 and the first ISP processor 130 based on the received statistical data. For example, the control parameters for the first camera 110 may include gain, integral time for exposure control, image stabilization parameters, flash control parameters, control parameters for the first lens 112 (e.g., focal length for focusing or zooming), or combinations of these parameters. The ISP control parameters may include gain levels and color correction matrices for automatic white balance and color adjustment (e.g., during RGB processing), and shadow correction parameters for the first lens 112.
[0053] Similarly, the second raw image captured by the second camera 120 is transmitted to the second ISP processor 140 for processing. After processing the second raw image, the second ISP processor 140 can send statistical data of the second raw image (such as image brightness, image contrast, image color, etc.) to the control logic unit 150. The control logic unit 150 can determine the control parameters of the second camera 120 based on the statistical data, so that the second camera 120 can perform operations such as automatic focusing and automatic exposure according to the control parameters. After being processed by the second ISP processor 140, the second raw image can be stored in the image memory 160. The second ISP processor 140 can also read the image stored in the image memory 160 for processing. In addition, after being processed by the ISP processor 140, the second raw image can be directly sent to the display 170 for display. The display 170 can also read the image in the image memory 160 for display. The second camera 120 and the second ISP processor 140 can also implement the processing procedures described for the first camera 110 and the first ISP processor 130.
[0054] In one embodiment, the first camera 110 may be a wide-angle camera, and the second camera 120 may be a telephoto camera. The first ISP processor 130 and the second ISP processor 140 may be the same ISP processor.
[0055] The electronic device can acquire images using the first camera 110 as the main camera to obtain a first original image. During the current magnification adjustment process, the electronic device acquires images using the second camera 120 to obtain a second original image. The second ISP processor 140 compresses the second original image based on compression information to obtain a compressed original image. The control logic unit 150 fuses the compressed original image and the first original image to obtain a fusion result. The control logic unit 150 updates the compression information based on the fusion result, and the second ISP processor 140 compresses the second intermediate image acquired by the second camera based on the updated compression information to obtain an intermediate compressed image. The control logic unit 150 uses the intermediate compressed image as the original compressed image for the next round, and the first intermediate image acquired by the first camera as the first original image for the next round. It then returns to the step of fusing the compressed original image and the first original image and continues execution until the magnification during the adjustment process meets the switching conditions. At this point, the control logic unit 150 switches the second camera to the main camera.
[0056] In one embodiment, such as Figure 2 As shown, a camera switching method is provided, which can be applied to... Figure 1 Taking an electronic device as an example, the explanation includes the following steps:
[0057] Step S202: Image acquisition is performed using the first camera as the main camera to obtain the first original image.
[0058] The electronic device includes at least two cameras, with the main camera referring to the primary camera used for image preview and acquisition. The first camera can be an ultra-wide-angle camera, a wide-angle camera, a telephoto camera, a super macro camera, or a depth camera, but is not limited to these. The first raw image refers to the image captured by the first camera. The first raw image can be any of the following: an RGB (Red, Green, Blue) image, a grayscale image, a depth image, or an image corresponding to the Y component of a YUV image, but is not limited to these. In a YUV image, "Y" represents luminance (or luma), which is the grayscale value, while "U" and "V" represent chroma (or chroma), which describe the color and saturation of the image and are used to specify the color of a pixel. The first raw image can be an image captured from any scene, such as an image of a person, a landscape, or an image of industrial equipment, but is not limited to these.
[0059] Specifically, the electronic device uses the first camera as the main camera to preview the image and collect image data to obtain the first raw image.
[0060] In one embodiment, a user can activate the camera function, and the electronic device, in response to the user's activation, will use the default camera as the primary camera to capture images. This default camera is the first camera.
[0061] In one embodiment, when a user uses the camera function, the electronic device can determine the camera currently acting as the main camera and designate the camera currently acting as the main camera as the first camera.
[0062] In one embodiment, the first camera captures images at a target frame rate and target resolution. Frame rate: the frequency or rate at which a bitmap image appears continuously on a display, measured in frames. Resolution, also known as image resolution or image sharpness, can be further subdivided into display resolution, image resolution, print resolution, and scan resolution. Resolution determines the level of detail in a bitmap image; generally, the higher the image resolution, the more pixels it contains, and the clearer the image. Image resolution refers to the amount of information stored in an image.
[0063] Step S204: During the current magnification adjustment process, an image is acquired through the second camera to obtain a second original image.
[0064] The second camera differs from the first camera; it serves as a secondary camera, used to assist in image acquisition. The image data acquired by the secondary camera supplements the image data acquired by the primary camera. The second camera can be an ultra-wide-angle camera, a wide-angle camera, a telephoto camera, a super macro camera, or a depth camera, but is not limited to these. The second raw image can be any of the following: RGB (Red, Green, Blue) image, grayscale image, depth image, or the image corresponding to the Y component of a YUV image, but is not limited to these. In a YUV image, "Y" represents luminance (or luma), i.e., grayscale value, while "U" and "V" represent chroma (or chroma), describing the color and saturation of the image and specifying the color of a pixel. The second raw image can be an image acquired from any scene. Magnification is an optical lens performance parameter, referring to the ratio of the image size of an object projected onto the focal plane by the lens to the actual size of the object. The larger the ratio, the greater the magnification.
[0065] Specifically, in response to a trigger operation for magnification adjustment, the electronic device adjusts the current magnification. During the magnification adjustment process, the electronic device acquires an image through a second camera to obtain a second original image.
[0066] Furthermore, the image acquisition interface displays the magnification corresponding to each camera in the electronic device. For example, the ultra-wide-angle camera has a magnification of 0.6X, the wide-angle camera has a magnification of 1X, and the telephoto camera has a magnification of 2X. Users can trigger the displayed magnification on the image acquisition interface to adjust the current magnification to the triggered target magnification, thus switching the camera corresponding to the target magnification to the current main camera. When a user triggers the displayed magnification, the electronic device determines the magnification triggered by the user's action as the target magnification and determines the current magnification. The electronic device adjusts the current magnification, causing it to gradually change until it reaches the target magnification. During this gradual change in magnification, the electronic device acquires an image through the second camera, obtaining a second original image.
[0067] It is understandable that, as the magnification gradually changes, the electronic device still uses the first camera as the main camera to capture images and obtain the first original image.
[0068] In one embodiment, the electronic device acquires a second original image by using a second camera at a target frame rate and target resolution.
[0069] Step S206: Compress the second original image to obtain the original compressed image.
[0070] Compression refers to the processing mechanism that reduces the size of computer data using specific algorithms. For example, reducing the size of image data. This mechanism can reduce the total number of bytes in the data, making data transmission faster and reducing the space required for data storage. Compression can be divided into lossy and lossless compression, processing data with or without loss to retain as much information as possible while reducing data size. Lossy compression allows for the loss of some information during the compression process, but the lost information has little impact on understanding the original data. Lossless compression utilizes the statistical redundancy of the data, completely recovering the original data without causing any distortion.
[0071] Specifically, the electronic device can compress the second original image to obtain a corresponding original compressed image. Further, the electronic device can compress the second original image based on pre-set compression information to reduce its resolution, thereby obtaining a corresponding original compressed image.
[0072] In one embodiment, the electronic device may compress the second original image based on at least one of the subject information and color information of the second original image to reduce the resolution of the second original image and obtain the original compressed image.
[0073] Step S208: The original compressed image and the first original image are fused to obtain the fusion result.
[0074] The fusion process can involve summing or averaging the matching pixels in the original compressed image and the first original image to obtain a new image, i.e., the fused result. The fusion process can also be a spatial alignment process, also known as image alignment or image registration.
[0075] Specifically, the electronic device can identify matching pixels in the original compressed image and the first original image, and fuse these matching pixels to obtain a fusion result. Further, the electronic device can sum the pixel values of the matching pixels in the original compressed image and the first original image to obtain a sum of pixel values. Based on each matching pixel and its corresponding sum of pixel values, a new image is generated, thus obtaining the fusion result.
[0076] Alternatively, the electronic device can average the pixel values of the matched pixels in the original compressed image and the first original image to obtain the average pixel values corresponding to each matched pixel. Based on each matched pixel and its corresponding average pixel value, a new image is generated, thus obtaining the fusion result.
[0077] Step S210: Determine whether the magnification during the adjustment process meets the camera switching conditions. If it does, proceed to step S216; otherwise, proceed to step S212.
[0078] Step S212: Based on the fusion result, the second intermediate image captured by the second camera is compressed to obtain an intermediate compressed image.
[0079] Specifically, the electronic device can determine at least one of the subject information and color information in the fusion result, and compress the next image captured by the second camera based on at least one of the subject information and color information to obtain the corresponding next compressed image. This next image is a second intermediate image, and the next compressed image is an intermediate compressed image.
[0080] In one embodiment, the electronic device may determine compression information for compressing the next image captured by the second camera based on the fusion result, and compress the second intermediate image captured by the second camera based on the determined compression information to obtain the corresponding intermediate compressed image.
[0081] Step S214: Use the intermediate compressed image as the original compressed image for the next round, use the first intermediate image captured by the first camera as the first original image for the next round, and return to step S208 and continue execution until the magnification during the adjustment process meets the switching conditions. Then execute step S216, that is, switch the second camera to the main camera.
[0082] Specifically, the electronic device can use the intermediate compressed image as the original compressed image for the next round and the first intermediate image captured by the first camera as the first original image for the next round, thereby returning to the step of fusing the original compressed image and the first original image and continuing execution. The current magnification gradually changes during the adjustment process until the magnification during the adjustment process meets the switching condition, at which point the compression processing of the first intermediate image captured by the second camera stops, and the second camera is switched to the main camera to continue capturing images.
[0083] In one embodiment, after switching the second camera to the main camera, the image captured by the second camera is used as the target image and output.
[0084] In one embodiment, after switching the second camera to the main camera, the first camera can be turned off, or the first camera can be used as a secondary camera for image acquisition, and the images acquired by the first camera and the second camera can be fused together as the target image.
[0085] In the aforementioned camera switching method, the first camera is used as the main camera to acquire images, obtaining a first original image. During the current magnification adjustment process, the second camera acquires images, obtaining a second original image. The second original image is compressed to reduce its resolution, resulting in a compressed original image. The compressed original image and the first original image are then fused to obtain a fusion result, ensuring consistency in field of view and effect between the two. Based on the fusion result, the second intermediate image acquired by the second camera is compressed to obtain an intermediate compressed image. This reduces the amount of image data transmitted by the second camera, preventing image data interruptions due to low bandwidth limitations and ensuring normal image data transmission. The intermediate compressed image is used as the original compressed image for the next round, and the first intermediate image acquired by the first camera is used as the first original image for the next round. The process then returns to the step of fusing the compressed original image and the first original image, continuing until the magnification during the adjustment process meets the switching conditions. At this point, the second camera is switched to the main camera. This effectively achieves a smooth switching of image data streams between different cameras, avoiding image jumps or stuttering, thus realizing a smooth camera switching process.
[0086] In one embodiment, during the adjustment of the current magnification, an image is acquired via a second camera to obtain a second original image, including:
[0087] In response to a trigger operation for magnification adjustment, the current magnification is adjusted; if the magnification meets the activation conditions during the adjustment process, the second camera is activated to acquire images and obtain a second original image.
[0088] Specifically, the image acquisition interface displays the magnification corresponding to each camera in the electronic device. When the user triggers the displayed magnification, the electronic device determines the magnification triggered by the user's trigger operation as the target magnification and determines the second camera corresponding to the target magnification.
[0089] The electronic device determines the current magnification and adjusts it gradually. It acquires the activation conditions for the second camera and, during the magnification adjustment process, determines whether the adjusted magnification meets these conditions. If the adjusted magnification meets the conditions, the electronic device activates the second camera corresponding to the target magnification and captures an image to obtain a second original image.
[0090] In one embodiment, the electronic device can obtain the activation conditions of the second camera. During the magnification adjustment process, it can determine at preset intervals whether the adjusted magnification meets the activation conditions. If the adjusted magnification does not meet the activation conditions, image preview and image acquisition are performed through the second camera. When the magnification during the adjustment process meets the activation conditions, the electronic device activates the second camera corresponding to the target magnification and performs image acquisition through the second camera to obtain a second original image. Simultaneously, image preview and image acquisition are performed through the first camera to obtain a first original image.
[0091] In this embodiment, in response to a trigger operation for magnification adjustment, the current magnification is adjusted to initiate the camera switching process. The current magnification gradually changes during the adjustment process. When the magnification meets the activation conditions during the adjustment process, the second camera is activated to acquire images, so as to simultaneously obtain images acquired by the first and second cameras. This allows for smooth camera switching through subsequent processing of the images acquired by the two cameras.
[0092] In one embodiment, the second original image is compressed to obtain an original compressed image, including:
[0093] Identify the main and non-main regions in the second original image; perform a first compression process on the main region and a second compression process on the non-main region to obtain the original compressed image, wherein the second compression process is different from the first compression process.
[0094] The main subject area refers to the region in the image where the target subject is located. Subjects can refer to various objects, such as people, flowers, cats, dogs, cows, blue skies, white clouds, and the background. The target subject is the desired subject and can be selected as needed. The non-subject area refers to the region in the image other than the main subject area.
[0095] The second compression process differs from the first compression process, which can mean that the compression amount of the second compression process is different from the compression amount of the first compression process. For example, the first compression amount corresponding to the first compression process is less than the second compression amount corresponding to the second compression process.
[0096] In one embodiment, the first compression amount is less than the compression threshold, and the second compression amount is greater than the compression threshold.
[0097] Specifically, the electronic device can perform subject detection on the second original image to identify the subject region and non-subject regions within the second original image. Subject detection refers to the automatic processing of the region of interest (ROI) while selectively ignoring non-ROI regions when faced with a scene. The ROI is called the subject region.
[0098] The electronic device performs a first compression process on the main subject region of the second original image and a second compression process on the non-subject regions to obtain an original compressed image. Further, the electronic device performs a first compression process on the main subject region of the second original image by a first compression amount to obtain a main subject region under the first compression amount. It then performs a second compression process on the non-subject regions by a second compression amount to obtain non-subject regions under the second compression amount. The original compressed image is generated based on the main subject region under the first compression amount and the non-subject regions under the second compression amount.
[0099] In one embodiment, the first compression amount can be 0, that is, the main body region in the second original image is not compressed, while the non-main body region is compressed, resulting in an original compressed image containing the uncompressed main body region and the compressed non-main body region.
[0100] In this embodiment, the main body region and non-main body region in the second original image are identified, the main body region is subjected to a first compression process, and the non-main body region is subjected to a second compression process. This can compress different degrees of key and non-key body regions in the image, and can prioritize the effect of key body regions under the limitation of low bandwidth. At the same time, it can effectively compress the amount of image data and reduce the resources required for image data transmission.
[0101] In one embodiment, compressing the second original image to obtain a compressed original image includes: identifying the main region and non-main regions in the second original image; and extracting the main region as the compressed original image. By extracting the main region from the original image and using it as the compressed original image for subsequent processing, the integrity of the main region data (as a key area) can be prioritized under low bandwidth constraints, while effectively compressing the data volume of the second original image.
[0102] In one embodiment, compressing the second original image to obtain an original compressed image includes: extracting the brightness information of the second original image and generating the original compressed image based on the brightness information.
[0103] Specifically, the electronic device can determine the color information in the second original image and obtain the brightness information of the second original image from the color information. The electronic device can then generate an original compressed image corresponding to the second original image based on the brightness information. Further, the color information can be color components. The electronic device can determine the color components in the second original image and obtain the target color component representing the brightness information from the color components, and generate the original compressed image based on the target color component. For example, if the Y, U, and V components in the second original image are determined, and the Y component represents luminance (i.e., the brightness information of the second original image), then the electronic device can generate the corresponding image based on the Y component and use the image corresponding to the Y component as the original compressed image.
[0104] In this embodiment, the brightness information of the second original image is extracted, and an original compressed image is generated based on the brightness information. This allows for the extraction of key data characterizing the image brightness, ensuring the accuracy of key image data while reducing data transmission rate. Furthermore, the fusion of the generated original compressed image based on the brightness information with the first original image ensures that the image does not exhibit significant abrupt changes, resulting in smoother switching of the image stream when switching cameras.
[0105] In one embodiment, compressing the second original image to obtain an original compressed image includes: compressing the second original image according to compression information to obtain an original compressed image;
[0106] The second intermediate image acquired by the second camera is compressed based on the fusion result to obtain an intermediate compressed image. This includes updating the compression information based on the fusion result and compressing the second intermediate image acquired by the second camera according to the updated compression information to obtain an intermediate compressed image.
[0107] The compression information refers to pre-set information used to compress the images captured by the second camera. The compression information may include at least one of subject information and color information. Specifically, the subject information may be the position of the target subject in the image, and the color information may be at least one of color components and color channels. Specifically, the color components may be at least one of the Y, U, and V components of the YUV color components.
[0108] Specifically, a color channel can be at least one of the color values of the red channel, the green channel, and the blue channel.
[0109] Specifically, the electronic device acquires pre-set compression information, compresses the original image according to the compression information, and obtains a corresponding original compressed image. The electronic device then fuses the original compressed image and the first original image to obtain a fused result.
[0110] The electronic device adjusts the current compression information based on the fusion result to update the current compression information, thus obtaining the updated compression information. Based on the updated compression information, the electronic device compresses the next second image captured by the second camera; this next second image becomes the second intermediate image, resulting in the corresponding intermediate compressed image.
[0111] In this embodiment, the electronic device can update the compression information for the next compression process based on the fusion effect of the current first original image and the current original compressed image. The updated compression information is then used to compress the image captured by the second camera next time, and then fused with the image captured by the first camera next time. The compression information is then updated again based on the fusion effect, so that the compression information for the next time can be adjusted in real time based on the current fusion effect. This allows the subsequent fusion effect to gradually converge in a better direction, thereby avoiding the phenomenon of image data stream stuttering or image jump when switching cameras.
[0112] In one embodiment, the second original image is compressed according to compression information to obtain an original compressed image, including:
[0113] When the compressed information includes subject information, the second original image is compressed based on the subject information to obtain the original compressed image; when the compressed information includes color information, the second original image is compressed based on the color information to obtain the original compressed image.
[0114] Specifically, the electronic device acquires and parses the compressed information. When the compressed information contains subject information, it indicates that the subject area in the image captured by the second camera needs to be compressed without compression or with a low compression amount, while the non-subject area is compressed normally. The electronic device can identify the subject area and non-subject area in the second original image, perform low compression on the subject area, or perform no compression on the subject area and normal compression on the non-subject area to obtain the original compressed image.
[0115] In one embodiment, the subject information may include the location of the subject region. The electronic device can identify the subject region in the second original image, segment the subject region, and obtain a subject region image. The electronic device can use this subject region image as the original compressed image.
[0116] In one embodiment, the subject information may include the location of the subject region, a first compression amount corresponding to the subject region, and a second compression amount corresponding to the non-subject region. The electronic device can identify the subject region and the non-subject region in the second original image, perform a first compression process on the subject region, and perform a second compression process on the non-subject region, generating a corresponding original compressed image based on the compressed subject region and the non-subject region.
[0117] In one embodiment, where the compressed information includes color information, the electronic device can extract image data related to the color information from the second original image to generate the original compressed image.
[0118] In this embodiment, when the color information includes color components, the electronic device can extract the image data corresponding to the color component from the second original image and generate an original compressed image based on the image data of the color component pair. For example, if the color information includes a Y component, the electronic device extracts the image data corresponding to the Y component from the original image and generates an original compressed image based on the image data corresponding to the Y component.
[0119] In this embodiment, when the color information includes color channels, the electronic device can extract the image data corresponding to that color channel from the second original image. An original compressed image is then generated based on the image data corresponding to that color channel. For example, if the color information includes a red channel, the electronic device acquires the image data corresponding to the red channel and generates the original compressed image based on that image data.
[0120] In this embodiment, when the compressed information includes subject information, indicating that the main area in the image is the area of key interest to the user, the second original image can be compressed based on identifying this area. This ensures that the image quality of the key area is considered when compressing the image data, thus guaranteeing the integrity and validity of the image data in the key area. When the compressed information includes color information, indicating that the user is concerned with the overall effect of the captured image, the second original image is compressed based on the color information. This effectively compresses the image data while preserving the original overall effect of the image, avoiding abrupt changes in the image when switching cameras.
[0121] like Figure 3The diagram illustrates the compression and spatial alignment process in one embodiment. The secondary camera, or second camera, captures a second original image, which can be a YUV image. This YUV image is transmitted to the image recognition and compression unit (Pre-ISP). The front-end image recognition and compression unit identifies the main and non-main regions in the YUV image. The main region is the key region, and the non-main region is the non-key region. The key region is compressed at a low compression rate or not compressed at all, while the non-key regions are compressed normally. The compressed key region and non-key region images are transmitted to the back-end via the MIPI (Mobile Industry Processor Interface). The back-end uses a spatial alignment algorithm to spatially align the key region image, non-key region image, and the corresponding first original image captured by the main camera, obtaining a fusion result. Based on the fusion result, the image compression requirement parameters are updated; these parameters are the compression information. These parameters are then returned to the front-end image recognition and compression unit for compression processing of the next image captured by the secondary camera. When the magnification changes to a certain level, the image processing unit shuts down the front-end image compression module, so that the secondary camera data is no longer compressed, and the secondary camera is switched to the primary camera.
[0122] like Figure 4 The diagram illustrates the changes in the main region in one embodiment. The main region is the key region, and the non-main region is the non-key region. The time-division processing of key and non-key regions is primarily to achieve different processing effects for different regions, ensuring that subsequent spatial alignment better meets user needs in the key region, thus prioritizing the effect of the key region under low bandwidth constraints. Therefore, differentiated compression processing is beneficial for meeting user needs under bandwidth limitations.
[0123] It's important to note that the image regions processed by the Pre-ISP side for differentiated compression change continuously as the information of the user's focus area changes. This means that the compression processing for each frame captured by the secondary camera may differ. Therefore, it's necessary to transmit the required parameters of the backend alignment algorithm (reflecting the desired effect) or the features of the user's focus area to the frontend in real time for image segmentation and compression. Specifically, the compression information is updated based on the fusion result obtained from spatial alignment processing, and this updated information is then transmitted to the frontend for compression processing of the next frame. As shown in the figure below, the position of the person (i.e., the target subject) in Sample 1 moves in subsequent image frames, indicating that the segmented region processed by the frontend changes continuously with the position of the person.
[0124] In this embodiment, the powerful image data processing capabilities of the front end are utilized to compress and resize the high-resolution image data acquired by the secondary camera, resulting in image data with reduced data volume. This image data is then sent to the back-end spatial alignment processing algorithm module for spatial alignment processing, and finally, smooth lens switching is performed.
[0125] For the transmission of secondary camera image data, only the image data corresponding to the focal plane and the brightness data related to the entire image can be transmitted. The focal plane area is the area of interest to the user. Transmitting the data in the focal plane area ensures that the alignment effect meets the user's needs, while transmitting the brightness information ensures that the image does not have obvious jumps. The combination of the two can meet the user's needs for smooth switching while greatly reducing the amount of data, and avoid abrupt changes in the image.
[0126] In one embodiment, updating the compressed information based on the fusion result includes: obtaining the current shooting mode, and updating the compressed information based on the fusion result and the current shooting mode.
[0127] Shooting mode refers to the mode selected when shooting, including portrait mode, night scene mode, slow motion mode, panorama mode, motion capture mode, etc., but not limited to these.
[0128] Specifically, after obtaining the fusion result, the electronic device can determine the current shooting mode, adjust the current compression information according to the current shooting mode and the fusion effect, update the current compression information, and obtain the updated compression information.
[0129] In this embodiment, the electronic device can determine the current shooting mode and the image information of interest under the current shooting mode. The image information may include subject information and color information. For example, portrait mode and motion capture mode focus more on the target subject in the image, that is, they focus more on the subject information of the image, while panorama mode and night scene mode focus more on the overall effect of the image, that is, they focus more on the color information of the image.
[0130] In this embodiment, when the current shooting mode focuses more on the subject information, the electronic device can determine the subject region in the fusion result and update the current compressed information to the location information related to the subject region, so that the updated compressed information includes the subject information, specifically the location information of the subject region.
[0131] When the current shooting mode focuses more on color information, the electronic device can determine the color information to be captured in the next image by the second camera based on the current fusion result, update the current compressed information to the color information to be captured in the next image by the second camera, so that the updated compressed information includes color information, specifically the color information to be captured in the next image.
[0132] When compressing image data from the second camera (i.e., the secondary camera), different color components can be processed for different image frames. For example, the R color component is acquired for frames 1, 4, and 7; the G color component is processed for frames 2, 5, and 8; and the B color component is processed for frames 3, 6, and 9 to generate their respective compressed images. Subsequent data frames are processed in the same manner, ensuring that the accuracy of the secondary camera data meets the processing requirements of the backend spatial alignment algorithm. Furthermore, the images acquired by the secondary camera can be divided into regions, for example, into four regions, with frames 1, 2, 3, and 4 processed according to the first, second, third, and fourth regions, respectively.
[0133] In this embodiment, obtaining the current shooting mode allows us to determine whether the current shooting mode focuses more on the overall color effect of the image or on the subject area, thus understanding the user's needs. Based on the fusion result and the current shooting mode, the compression information is updated. This ensures that when the next image captured by the secondary camera is compressed using the updated compression information, the accuracy of the image data corresponding to the user's needs is guaranteed, ensuring that the compressed image still meets the user's requirements.
[0134] In one embodiment, fusing the original compressed image and the first original image to obtain a fusion result includes: spatially aligning the original compressed image and the first original image, and fusing the aligned original compressed image and the aligned first original image to obtain a fusion result.
[0135] Spatial alignment processing refers to aligning the viewpoints and effects of two or more images acquired at different times, with different imaging devices (such as different cameras) or under different conditions (such as climate, illumination, camera position and angle).
[0136] Specifically, the electronic device can use camera calibration parameters to spatially align the original compressed image and the first original image, obtaining aligned original compressed images and aligned first original images. The electronic device can then identify matching pixels in the aligned original compressed image and aligned first original image, sum the pixel values of the matching pixels, and generate a fused image based on the sum of the pixel values corresponding to each pixel. This fused image is the fusion result. Alternatively, the electronic device can identify matching pixels in the aligned original compressed image and aligned first original image, sum the pixel values of the matching pixels, and calculate the average value. Based on the average pixel value corresponding to each pixel, a fused image is generated, which is the fusion result.
[0137] In one embodiment, spatial alignment processing is image registration processing, also known as image alignment processing. Image registration is the process of matching and superimposing two or more images acquired at different times, with different imaging devices (e.g., different cameras) or under different conditions (e.g., climate, illumination, camera position and angle).
[0138] The electronic device can identify matching pixels in the original compressed image and the first original image, and determine transformation parameters between the original compressed image and the first original image based on these matching pixels. The electronic device can then map the first original image to the same image space as the original compressed image based on the transformation parameters, obtaining a registered first original image. Since the original compressed image is obtained from the second original image, and the original compressed image and the second original image reside in the same image space, have the same viewpoint, and the same image effect, the registered first original image and the second original image also reside in the same image space, have the same viewpoint, and the same image effect. The second original image is captured by the second camera, meaning it is captured only from the second camera's viewpoint. Therefore, the transformation parameters map the first original image to the same image space as the original compressed image, transforming the first original image from the first camera's viewpoint to the second camera's viewpoint. The registered first original image and the original compressed image are then fused, and the resulting fused image is also from the second camera's viewpoint.
[0139] In this embodiment, the original compressed image and the first original image are spatially aligned so that they are in the same image space. The aligned original compressed image and the aligned first original image are then fused together, resulting in a fused image that falls within the perspective of the second camera. This ensures that the user's viewpoint is consistent with the second camera's perspective, guaranteeing consistent image quality before and after camera switching. Furthermore, when switching from the second camera to the main camera, the user's viewpoint does not change significantly, effectively achieving a smooth transition from the first camera's perspective to the second camera's perspective.
[0140] In one embodiment, such as Figure 5 As shown, a camera switching method is provided for use in electronic devices. This method enables a smooth switching scheme for SAT (Summed Area Table) that adaptively adjusts based on the front-end resolution. The method includes:
[0141] Step S502: Open the camera, use the first camera as the main camera to start image preview and image acquisition at the target frame rate and target resolution, and obtain the first raw image.
[0142] In step S504, the user adjusts the magnification according to their needs, such as adjusting the current magnification of the first camera to 0.6X, 1X, 2X, 5X, 20X, etc. When the user adjusts the magnification, the zoom value will gradually change; the zoom value increases as the magnification increases, and the zoom value decreases as the magnification decreases.
[0143] Step S506: Initialize the spatial alignment algorithm, the front-end data compression algorithm, and the secondary camera.
[0144] Step S508: When the zoom value reaches a certain level (first zoom threshold), the secondary camera is activated. The secondary camera outputs a data stream at the target frame rate and target resolution to obtain the second original image; the secondary camera is the second camera.
[0145] In step S510, the front-end data compression unit compresses the secondary camera image data, and then executes step S512.
[0146] Step S512 involves spatially aligning the compressed image and the main camera image using a backend spatial alignment algorithm. This involves spatially aligning the original compressed images of the first and second original images to obtain a fusion result. The spatial alignment algorithm updates the required parameters for the front-end image recognition compression unit based on the user's needs and the current fusion result, and adds these parameters to the request for each frame. The user's needs can be represented by the current shooting mode, and the required parameters are the compression information. After executing step S512, if the current magnification reaches the second magnification threshold, step S516 is executed; otherwise, step S514 is executed.
[0147] In step S514, the image compression module of the front-end module parses the requirement parameters brought down by the request and adjusts the compression area accordingly to perform key area analysis on the next image captured by the secondary camera, so as to return to step S510 and continue execution, so that the final compression result can meet the requirements of spatial alignment processing.
[0148] In step S518, when the magnification changes to a certain level (second magnification threshold), the front-end image recognition compression unit is turned off, so that the secondary camera data is no longer compressed, and the lens switching is prepared, that is, the switching between the main and secondary cameras is carried out, thus completing the entire SAT switching process.
[0149] Step S520: Continue previewing or shooting using the switched main camera.
[0150] In this embodiment, when the zoom value changes to the threshold for pre-switching, the secondary camera is first activated at the target frame rate and target resolution to start outputting image data. Due to bandwidth limitations, the secondary camera cannot output data at a high frame rate and full size, while the main camera, to ensure the preview effect, still outputs data at the target frame rate and target resolution. Therefore, to ensure the spatial alignment effect (processing speed and effect) of the backend module under low bandwidth constraints, it is necessary to reduce the amount of data transmitted per unit time. Thus, the secondary camera data is compressed to reduce the resolution. The compression process is dynamically performed on the secondary camera image data according to the data requirements of the backend spatial alignment algorithm, and the compression strategy is adjusted in real time according to the requirements, satisfying the backend processing algorithm's requirements for the secondary camera data under low bandwidth constraints. Resolution adjustment can be achieved by compressing the entire image, or by selectively processing different color components separately according to the requirements of the alignment algorithm, or by dividing the image into blocks before compression. Different compression methods are provided for different needs, adapting to different scenarios.
[0151] Furthermore, since the resolution is adjusted based on the target frame rate and target resolution, there is no need to reconfigure the image sensor's output parameters such as frame rate and resolution when switching between the main and secondary cameras. The sensor's configuration parameters are directly set to the target output parameters. This saves switching time when switching from the secondary camera to the main camera after spatial alignment, avoids stuttering caused by parameter reconfiguration, and enables faster data stream switching. It also avoids image data interruption caused by parameter adjustment, ensuring the continuity of image data.
[0152] In one embodiment, a camera switching method is provided, applied to an electronic device, comprising:
[0153] The first camera is used as the main camera to capture images at the target frame rate and target resolution, thus obtaining the first raw image.
[0154] Next, in response to the trigger operation of the magnification adjustment, the current magnification is adjusted; if the magnification during the adjustment process meets the activation conditions, the second camera is activated to acquire images at the target frame rate and target resolution to obtain the second original image.
[0155] Next, the second original image is compressed according to the compression information to obtain the original compressed image.
[0156] Optionally, if the compressed information includes subject information, the second original image is compressed based on the subject information to obtain the original compressed image.
[0157] Optionally, if the compression information includes color information, the second original image is compressed based on the color information to obtain the original compressed image.
[0158] Furthermore, the original compressed image and the first original image are spatially aligned, and the aligned original compressed image and the aligned first original image are fused to obtain a fusion result.
[0159] Next, the current shooting mode is obtained, and the compression information is updated based on the fusion result and the current shooting mode.
[0160] Next, the second intermediate image captured by the second camera is compressed according to the updated compression information to obtain an intermediate compressed image.
[0161] Furthermore, the intermediate compressed image is used as the original compressed image for the next round, and the first intermediate image captured by the first camera is used as the first original image for the next round. The process returns to the step of fusing the original compressed image and the first original image and continues until the magnification during the adjustment process meets the switching conditions. Then, the second camera is switched to the main camera.
[0162] Furthermore, the first camera is turned off, and the second camera is used as the main camera for image preview or image capture to obtain the target image.
[0163] In this embodiment, the first camera, acting as the main camera, captures images at the target frame rate and target resolution to obtain a first raw image at the target resolution. The current magnification gradually changes during adjustment. During this adjustment, the second camera captures images at the target frame rate and target resolution to obtain a second raw image at the target resolution. This allows simultaneous acquisition of images from both the first and second cameras, with the target frame rate and target resolution being the same for both. This eliminates the need to readjust the frame rate and resolution output parameters during subsequent camera switching, saving adjustment time. The second raw image is then compressed to reduce its resolution, resulting in a low-resolution compressed raw image. This reduces the amount of image data transmitted by the second camera under low bandwidth constraints, preventing image data interruptions due to bandwidth limitations.
[0164] The original compressed image and the first original image are aligned to maintain consistency in field of view and effect. Based on the fusion effect of the current first original image and the current original compressed image, the compression information for the next compression process is updated. This allows for real-time adjustment of the compression information based on the current fusion effect. The intermediate compressed image is used as the original compressed image for the next round, and the first intermediate image captured by the first camera is used as the first original image for the next round. The process then returns to the step of fusing the original compressed image and the first original image and continues, allowing the subsequent fusion effect to gradually converge in a positive direction. This process stops when the magnification during adjustment meets the switching condition, and the second camera is switched to the main camera. This effectively achieves a smooth switching of image data streams from different cameras, avoiding image jumps or stuttering, thus realizing a smooth camera switching.
[0165] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0166] Based on the same inventive concept, this application also provides a camera switching device for implementing the camera switching method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more camera switching device embodiments provided below can be found in the limitations of the camera switching method described above, and will not be repeated here.
[0167] In one embodiment, such as Figure 6 As shown, a camera switching device 600 is provided, including: a first acquisition module 602, a second acquisition module 604, a fusion module 606, a compression module 608, and a switching module 610, wherein:
[0168] The first acquisition module 602 is used to acquire images using the first camera as the main camera to obtain the first original image.
[0169] The second acquisition module 604 is used to acquire images through the second camera during the current magnification adjustment process to obtain a second original image.
[0170] The fusion module 606 is used to compress the second original image to obtain an original compressed image, and then fuse the original compressed image and the first original image to obtain a fusion result.
[0171] Compression module 608 is used to compress the second intermediate image captured by the second camera based on the fusion result to obtain an intermediate compressed image.
[0172] The switching module 610 is used to use the intermediate compressed image as the original compressed image for the next round, use the first intermediate image captured by the first camera as the first original image for the next round, and return to the step of fusing the original compressed image and the first original image and continue to execute until the magnification in the adjustment process meets the switching conditions, and then switch the second camera to the main camera.
[0173] In this embodiment, a first camera is used as the main camera to acquire images, obtaining a first original image. During the current magnification adjustment process, a second camera is used to acquire images, obtaining a second original image. The second original image is compressed to obtain a compressed original image. The compressed original image and the first original image are then fused to obtain a fusion result, ensuring that the compressed original image and the first original image maintain consistency in field of view and effect. Based on the fusion result, the second intermediate image acquired by the second camera is compressed to obtain an intermediate compressed image. This reduces the amount of image data transmitted by the second camera, avoiding image data interruption due to low bandwidth limitations and ensuring normal image data transmission. The intermediate compressed image is used as the original compressed image for the next round, and the first intermediate image acquired by the first camera is used as the first original image for the next round. The process then returns to the step of fusing the compressed original image and the first original image and continues until the magnification during the adjustment process meets the switching conditions. At this point, the second camera is switched to the main camera. This effectively achieves a smooth switching of image data streams between different cameras, avoiding image jumps or stuttering, thus realizing smooth camera switching.
[0174] In one embodiment, the second acquisition module 604 is further configured to adjust the current magnification in response to a trigger operation for magnification adjustment; and if the magnification meets the activation conditions during the adjustment process, the second camera is activated to acquire images and obtain a second original image.
[0175] In this embodiment, in response to a trigger operation for magnification adjustment, the current magnification is adjusted to initiate the camera switching process. The current magnification gradually changes during the adjustment process. When the magnification meets the activation conditions during the adjustment process, the second camera is activated to acquire images, so as to simultaneously obtain images acquired by the first and second cameras. This allows for smooth camera switching through subsequent processing of the images acquired by the two cameras.
[0176] In one embodiment, the fusion module 606 is further configured to identify the subject region and non-subject region in the second original image; perform a first compression process on the subject region and a second compression process on the non-subject region to obtain the original compressed image.
[0177] In this embodiment, the main body region and non-main body region in the second original image are identified, the main body region is subjected to a first compression process, and the non-main body region is subjected to a second compression process. This can compress different degrees of key and non-key body regions in the image, and can prioritize the effect of key body regions under the limitation of low bandwidth. At the same time, it can effectively compress the amount of image data and reduce the resources required for image data transmission.
[0178] In one embodiment, the fusion module 606 is further configured to extract the brightness information of the second original image and generate the original compressed image based on the brightness information.
[0179] In this embodiment, the brightness information of the second original image is extracted, and an original compressed image is generated based on the brightness information. This allows for the extraction of key data characterizing the image brightness, ensuring the accuracy of key image data while reducing data transmission rate. Furthermore, the fusion of the generated original compressed image based on the brightness information with the first original image ensures that the image does not exhibit significant abrupt changes, resulting in smoother switching of the image stream when switching cameras.
[0180] In one embodiment, the fusion module 606 is further configured to compress the second original image according to the compression information to obtain the original compressed image;
[0181] The compression module 608 is also used to update the compression information based on the fusion result, and to compress the second intermediate image captured by the second camera according to the updated compression information to obtain an intermediate compressed image.
[0182] In this embodiment, the electronic device can update the compression information for the next compression process based on the fusion effect of the current first original image and the current original compressed image. The updated compression information is then used to compress the image captured by the second camera next time, and then fused with the image captured by the first camera next time. The compression information is then updated again based on the fusion effect, so that the compression information for the next time can be adjusted in real time based on the current fusion effect. This allows the subsequent fusion effect to gradually converge in a better direction, thereby avoiding the phenomenon of image data stream stuttering or image jump when switching cameras.
[0183] In one embodiment, the fusion module 606 is further configured to compress the second original image based on the subject information to obtain an original compressed image when the compressed information includes subject information; and to compress the second original image based on the color information to obtain an original compressed image when the compressed information includes color information.
[0184] In this embodiment, when the compressed information includes subject information, indicating that the main area in the image is the area of key interest to the user, the second original image can be compressed based on identifying this area. This ensures that the image quality of the key area is considered when compressing the image data, thus guaranteeing the integrity and validity of the image data in the key area. When the compressed information includes color information, indicating that the user is concerned with the overall effect of the captured image, the second original image is compressed based on the color information. This effectively compresses the image data while preserving the original overall effect of the image, avoiding abrupt changes in the image when switching cameras.
[0185] In one embodiment, the compression module 608 is further configured to obtain the current shooting mode and update the compression information based on the fusion result and the current shooting mode.
[0186] In this embodiment, obtaining the current shooting mode allows us to determine whether the current shooting mode focuses more on the overall color effect of the image or on the subject area, thus understanding the user's needs. Based on the fusion result and the current shooting mode, the compression information is updated. This ensures that when the next image captured by the secondary camera is compressed using the updated compression information, the accuracy of the image data corresponding to the user's needs is guaranteed, ensuring that the compressed image still meets the user's requirements.
[0187] In one embodiment, the fusion module 606 is further configured to perform spatial alignment processing on the original compressed image and the first original image, and to perform fusion processing on the aligned original compressed image and the aligned first original image to obtain a fusion result.
[0188] In this embodiment, the original compressed image and the first original image are spatially aligned so that they are in the same image space. The aligned original compressed image and the aligned first original image are then fused together, resulting in a fused image that falls within the perspective of the second camera. This ensures that the user's viewpoint is consistent with the second camera's perspective, guaranteeing consistent image quality before and after camera switching. Furthermore, when switching from the second camera to the main camera, the user's viewpoint does not change significantly, effectively achieving a smooth transition from the first camera's perspective to the second camera's perspective.
[0189] Each module in the aforementioned camera switching device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0190] In one embodiment, an electronic device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown, the electronic device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a camera switching method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0191] Those skilled in the art will understand that Figure 7The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0192] This application also provides a computer-readable storage medium. One or more non-volatile computer-readable storage media containing computer-executable instructions, which, when executed by one or more processors, cause the processors to perform the steps of a camera switching method.
[0193] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute a camera switching method.
[0194] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0195] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0196] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0197] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A camera switching method, characterized in that, include: The first original image is obtained by capturing images using the first camera as the main camera; During the current magnification adjustment process, the second camera is used as a secondary camera to acquire images, thus obtaining a second original image; When the preset compression information includes subject information, the subject region and non-subject region in the second original image are identified, the subject region is subjected to a first compression process, and the non-subject region is subjected to a second compression process to obtain the original compressed image. The first compression amount corresponding to the first compression process is less than the second compression amount corresponding to the second compression process; When the preset compression information includes color information, the second original image is compressed based on the color information to obtain the original compressed image; The original compressed image and the first original image are fused together to obtain a fusion result; Determine the current shooting mode. When the current shooting mode focuses on subject information, update the preset compressed information based on the subject region in the fusion result, so that the updated compressed information includes the updated subject information. When the current shooting model focuses on color information, the preset compressed information is updated to the color information required to be captured in the next image captured by the second camera based on the fusion result, so that the updated compressed information includes the color information to be captured. The second intermediate image captured by the second camera is compressed according to the updated compression information to obtain an intermediate compressed image. The intermediate compressed image is used as the original compressed image for the next round, and the first intermediate image captured by the first camera is used as the first original image for the next round. The process of fusing the original compressed image and the first original image is returned and continued until the magnification during the adjustment process meets the switching conditions. Then, the second camera is switched to the main camera.
2. The method according to claim 1, characterized in that, The process of acquiring a second original image through a second camera during the adjustment of the current magnification includes: In response to a trigger operation for multiplier adjustment, the current multiplier is adjusted; If the magnification during the adjustment process meets the activation conditions, the second camera is activated to acquire images and obtain the second original image.
3. The method according to claim 1, characterized in that, The color information includes brightness information; the compression process based on the color information to obtain the original compressed image includes: The brightness information of the second original image is extracted, and the original compressed image is generated based on the brightness information.
4. The method according to any one of claims 1 to 3, characterized in that, The step of fusing the original compressed image and the first original image to obtain a fusion result includes: The original compressed image and the first original image are spatially aligned, and the aligned original compressed image and the aligned first original image are then fused to obtain a fusion result.
5. A camera switching device, characterized in that, include: The first acquisition module is used to acquire images using the first camera as the main camera to obtain the first raw image; The second acquisition module is used to acquire images using the second camera as a secondary camera during the current magnification adjustment process to obtain a second original image; The fusion module is used to identify the main body region and non-main body region in the second original image when the preset compression information includes main body information, perform a first compression process on the main body region, and perform a second compression process on the non-main body region to obtain the original compressed image. The first compression amount corresponding to the first compression process is less than the second compression amount corresponding to the second compression process; when the preset compression information includes color information, the second original image is compressed based on the color information to obtain the original compressed image; the original compressed image and the first original image are fused to obtain a fusion result. A compression module is used to determine the current shooting mode. When the current shooting mode focuses on subject information, the preset compression information is updated based on the subject region in the fusion result, so that the updated compression information includes the updated subject information. When the current shooting model focuses on color information, the preset compression information is updated based on the fusion result to the color information required to be captured in the next image captured by the second camera, so that the updated compression information includes the color information to be captured; the second intermediate image captured by the second camera is compressed according to the updated compression information to obtain an intermediate compressed image; The switching module is used to use the intermediate compressed image as the original compressed image for the next round, use the first intermediate image captured by the first camera as the first original image for the next round, and return to the step of fusing the original compressed image and the first original image and continue to execute until the magnification in the adjustment process meets the switching conditions, and then switch the second camera to the main camera.
6. The apparatus according to claim 5, characterized in that, The second acquisition module is also used to adjust the current magnification in response to a trigger operation for magnification adjustment; if the magnification meets the activation conditions during the adjustment process, the second camera is activated to acquire images and obtain a second original image.
7. The apparatus according to claim 5, characterized in that, The color information includes brightness information; the fusion module is further configured to extract the brightness information of the second original image and generate an original compressed image based on the brightness information.
8. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the computer program is executed by the processor, it causes the processor to perform the steps of the method as described in any one of claims 1 to 4.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 4.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.