A method of camera preview and apparatus therefor
Patent Information
- Application Number
- CN202280004284.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-20
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2042-06-20
AI Technical Summary
当前技术中,相机在预览画质时,无法区分当前环境的光照情况,致使相机的预览图像效果并不理想
[0014] By acquiring ambient brightness values and automatically selecting different target preview modes, the best image processing mode can be chosen for different ambient brightness values, thereby enhancing the camera's preview effect and improving the camera's user experience.
Smart Images

Figure CN117652150B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and more particularly to a method and apparatus for camera preview. Background Technology
[0002] Image quality is one of the most important factors determining the user experience of a camera. Manufacturers utilize various hardware and software technologies to improve image quality. However, current technology cannot distinguish ambient lighting conditions when previewing images, resulting in less than ideal preview results. Summary of the Invention
[0003] This disclosure provides a method and apparatus for camera preview, which can be applied to the fields of mobile phones or cameras. For example, it can be used for taking photos and videos with a mobile phone or camera. By determining the lighting conditions around the shooting scene and selecting different preview modes, better photo effects can be achieved.
[0004] In a first aspect, embodiments of this disclosure provide a camera preview method, the method comprising: starting a camera and executing a camera preview process to acquire a preview image; obtaining an ambient brightness value of the environment in which the camera is located; generating a preview mode invocation instruction based on the ambient brightness value and a brightness threshold, the invocation instruction including a target preview mode; executing the invocation instruction to invoke the target preview mode, and generating a target preview image of the camera based on the target preview mode and displaying it in the preview area of the camera.
[0005] In one embodiment of this disclosure, generating a target preview image of a camera based on a target preview mode and an initial preview image includes: in response to the target preview mode being a first preview mode, obtaining a first target magnification of the camera; performing pixel fusion on the initial preview image to obtain a fused preview image; scaling the fused preview image based on the first target magnification to generate a first scaled preview image; and adjusting the resolution of the first scaled preview image to a preset resolution to generate the target preview image.
[0006] In one embodiment of this disclosure, a camera preview method further includes: acquiring image feature data of a fused preview image; determining an image level of the fused preview image based on the image feature data and preset image feature data; adjusting the pixel fusion rate based on the image feature data and preset image feature data in response to an image level lower than an image level threshold; and re-fusing the pixels of the initial preview image based on the adjusted pixel fusion rate.
[0007] In one embodiment of this disclosure, invoking a target preview mode and generating a target preview image of the camera based on the target preview mode and an initial preview image includes: in response to the target preview mode being a second preview mode, obtaining a second target magnification of the camera; scaling the initial preview image based on the second target magnification to generate a second scaled image; and adjusting the resolution of the first scaled preview image to a preset resolution to generate the target preview image.
[0008] In one embodiment of this disclosure, obtaining the ambient brightness value of the environment in which the camera is located includes: collecting light information of the environment based on a photosensitive element to determine the ambient brightness value; or, obtaining the screen brightness of an initial preview image and determining the ambient brightness value based on the screen brightness.
[0009] In one embodiment of this disclosure, the camera preview method further includes: generating multiple candidate target preview images based on all candidate preview modes and an initial preview image; selecting the candidate target preview image with the highest resolution from the multiple candidate target preview images as the target preview image, and binding the candidate preview mode corresponding to the candidate target preview image with the current ambient brightness value.
[0010] Secondly, embodiments of this disclosure provide another camera preview device, characterized in that the device includes: a startup module, used to start the camera and execute the camera's preview process to acquire an initial preview image to be previewed; an acquisition module, used to acquire the ambient brightness value of the environment in which the camera is located; a generation module, used to generate a preview mode call instruction based on the ambient brightness value and a brightness threshold, the call instruction including a target preview mode; and an execution module, used to execute the call instruction, call the target preview mode, generate a target preview image of the camera based on the target preview mode and the initial preview image, and display the target preview image in the camera's preview area.
[0011] Thirdly, this disclosure proposes an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to implement the camera preview method as described in the first aspect of this disclosure.
[0012] Fourthly, this disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to implement the camera preview method as described in the first aspect of this disclosure.
[0013] Fifthly, this disclosure provides a computer program product, including a computer program that, when executed by a processor, is used to implement the camera preview method as described in the first aspect of this disclosure.
[0014] By acquiring ambient brightness values and automatically selecting different target preview modes, the best image processing mode can be chosen for different ambient brightness values, thereby enhancing the camera's preview effect and improving the camera's user experience. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments or background art of this disclosure, the accompanying drawings used in the embodiments or background art of this disclosure will be described below.
[0016] Figure 1 This is a schematic flowchart of a camera preview method provided in an embodiment of this disclosure;
[0017] Figure 2 This is a flowchart illustrating another camera preview method provided in an embodiment of this disclosure;
[0018] Figure 3 This is a schematic diagram of the four-color filtering array algorithm provided in the embodiments of this disclosure;
[0019] Figure 4 This is a flowchart of the first preview mode provided in the embodiments of this disclosure;
[0020] Figure 5 This is a flowchart illustrating another camera preview method provided in an embodiment of this disclosure;
[0021] Figure 6 This is a flowchart of the second preview mode provided in the embodiments of this disclosure;
[0022] Figure 7 This is a schematic diagram of the overall process of a camera preview method provided in an embodiment of this disclosure;
[0023] Figure 8 This is a structural block diagram of a camera preview device provided in an embodiment of this disclosure;
[0024] Figure 9 This is a structural block diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0025] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0026] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the present disclosure. The singular forms “a” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0027] It should be understood that although the terms first, second, third, etc., may be used to describe various information in embodiments of this disclosure, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first information may also be referred to as second information without departing from the scope of embodiments of this disclosure, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein can be interpreted as "when," "in response to a determination," or "when," or "in the event of a determination."
[0028] For the sake of brevity and ease of understanding, this document uses the terms "greater than" or "less than", "higher than" or "lower than" to describe size relationships. However, it will be understood by those skilled in the art that the term "greater than" also includes the meaning of "greater than or equal to", and "less than" also includes the meaning of "less than or equal to"; the term "higher than" also includes the meaning of "higher than or equal to", and "lower than" also includes the meaning of "lower than or equal to".
[0029] The camera preview method and apparatus provided in this disclosure will now be described in detail with reference to the accompanying drawings.
[0030] Please see Figure 1 , Figure 1 This is a schematic flowchart illustrating a camera preview method provided in an embodiment of this disclosure. Figure 1 As shown, the method may include, but is not limited to, the following steps:
[0031] S11, start the camera and execute the camera preview process, and capture the initial preview image to be previewed.
[0032] It should be noted that the camera in this embodiment can be a digital still camera (DSC) or a shooting device attached to other electronic devices, such as a shooting device on a mobile phone or a shooting device on a PDA, etc., without any limitation.
[0033] The camera in this embodiment includes a Color Filter Array (CFA) function. This involves covering the surface of a pixel array with a color filter array (CFA). There are various types of color filter arrays, with the Bayer format filter array being the most widely used. It follows the GRBG rule, where the number of green pixels is twice the number of red or blue pixels. This is because the peak of the human eye's sensitivity to the visible light spectrum is located in the mid-wavelength band, which corresponds precisely to the green spectral component. In this mode, the image data uses only one of the three values (R, G, B) to represent a pixel, missing the other two color values. This results in a mosaic image. To obtain a full-color image, the color information of the surrounding pixels is used to estimate the missing two colors; this process is called color interpolation.
[0034] CFA is widely used in mobile devices due to its low power consumption, low price, and excellent image quality.
[0035] When you open a camera or the camera app on an electronic device, you can preview the live feed captured by the camera on the screen. This feature is called the camera's preview function. Users can use the preview function to adjust the camera or shooting actions to obtain the best shooting results.
[0036] The initial preview image is the initial image captured by the camera. The initial image needs to be processed before it can be displayed on the screen for users to preview.
[0037] S12, obtain the ambient brightness value of the environment where the camera is located.
[0038] Brightness value refers to the ratio of the light intensity of the luminous body to the area of the light source, and is defined as the brightness per unit of the light source, that is, the luminous intensity per unit projected area. In the embodiments of this disclosure, ambient brightness refers to the light intensity that the camera can access when capturing the initial preview image.
[0039] Ambient brightness is related to the intensity of external light, as well as the camera's shooting angle. For example, when the camera is in the same shooting environment, the ambient brightness value can be different when shooting with front lighting, backlighting, or top lighting.
[0040] In this embodiment of the disclosure, there are various methods for obtaining the ambient brightness value. For example, the ambient brightness can be determined based on a brightness detection device. Alternatively, the ambient brightness can also be determined by the brightness of an initial preview image.
[0041] In certain shooting environments, such as a photography studio, the ambient brightness can be preset and directly input into the camera.
[0042] S13, based on the ambient brightness value and brightness threshold, generate a preview mode call instruction, which includes the target preview mode.
[0043] In this embodiment, the lighting conditions for the camera to capture the initial preview image can be determined based on the ambient brightness value and a brightness threshold. It should be noted that the brightness threshold is pre-set and can be multiple, used to accurately determine the current lighting condition level, thereby selecting a suitable target preview mode and improving the camera preview effect.
[0044] Depending on the ambient brightness and brightness threshold, the target preview mode can vary, and the specific setting needs to be determined based on actual requirements. Especially in low-light environments, the initial preview image captured by the camera may have insufficient light sensitivity, leading to an excessively high signal-to-noise ratio (SNR) sent to the image signal processor. This results in poor image quality and ultimately a subpar preview. Therefore, a special low-light environment preview mode is needed to process the initial preview image and generate a better preview image. Multiple target preview modes are available, and the selection depends on the ambient brightness and brightness threshold. The signal-to-noise ratio (SNR) of an image is the ratio of the power spectrum of the image signal to that of the noise. A higher SNR indicates greater noise affecting image quality, resulting in a lower final image quality.
[0045] After determining the target preview mode, the processor can generate a call command based on the target preview mode and send it to the camera to adjust to that target preview mode. It should be noted that this processor can be the camera's processor or the processor of an electronic device, such as the processor of a mobile phone or tablet computer. There are no restrictions here, and the specific configuration needs to be determined according to the actual situation.
[0046] S14, execute the call instruction, call the target preview mode, generate the target preview image of the camera based on the target preview mode and the initial preview image, and display the target preview image in the camera's preview area.
[0047] After generating a call command based on the ambient brightness value, the camera can be adjusted to the target preview mode in the call command. The camera then processes the initial preview image based on the target preview mode to generate the target preview image, which is then displayed to the user through the preview area.
[0048] In this embodiment, the camera is first activated and its preview process is executed to acquire an initial preview image. Then, the ambient brightness value of the camera's environment is obtained. Next, based on the ambient brightness value and a brightness threshold, a preview mode invocation command is generated, including the target preview mode. Finally, the invocation command is executed to invoke the target preview mode, and a target preview image is generated based on the target preview mode and the initial preview image. This target preview image is then displayed in the camera's preview area. Therefore, by acquiring the ambient brightness value and automatically selecting different target preview modes, the optimal image processing mode can be chosen for different ambient brightness values, thereby enhancing the camera's preview effect and improving the user experience.
[0049] In this embodiment of the disclosure, the ambient brightness value of the environment in which the camera is located can be obtained by collecting light information from the environment using a photosensitive element to determine the ambient brightness value. For example, the photosensitive element can be a light detection sensor, a photoresistor sensor, etc. The photosensitive element receives light information, determines the light intensity, and sends the light intensity to the processor for processing.
[0050] Optionally, brightness information can be directly obtained from the image signal output by the image sensor, and then processed to obtain the ambient brightness value of the surrounding environment. Compared to the previous method of determining the ambient brightness value through a photosensitive element, obtaining the ambient brightness value through the brightness information of the initial preview image can also provide additional analytical data about the shooting scene, such as the front aperture value, exposure time, and ISO value. This saves on metering equipment and allows for analysis of the image information with the current aperture value, exposure time, and ISO value to determine whether the current exposure parameters are appropriate. It should be noted that this method of determining the ambient brightness value based on brightness information can be an Auto Exposure (AE) algorithm.
[0051] In some scenarios, due to environmental factors such as heavy fog, rain, or high temperatures, the target preview image obtained using the target preview mode may be unsatisfactory, requiring a reselection of the preview mode. In such cases, multiple candidate target preview images can be generated based on all candidate preview modes in the camera and the initial preview image. Then, the candidate target preview image with the highest resolution is selected as the target preview image. The preview mode corresponding to the highest resolution candidate target preview image is then bound to the current ambient brightness value. This allows for quick determination of the optimal target preview mode when encountering the same scene again, improving the camera's user experience.
[0052] In this embodiment, an ambient brightness value and a brightness threshold can be compared. In response to an ambient brightness value being less than the brightness threshold, a first preview mode is selected as the target preview mode from candidate preview modes, and a calling instruction is generated based on the first preview mode. Alternatively, in response to an ambient brightness value being greater than or equal to the brightness threshold, a second preview mode is selected as the target preview mode from candidate preview modes, and a calling instruction is generated based on the second preview mode. It should be noted that the brightness threshold may differ for different cameras. Optionally, the brightness threshold may also differ for different cameras based on different shooting environments; no limitation is made here. The brightness threshold can be pre-set and can be changed according to actual design requirements.
[0053] It should be noted that the embodiments disclosed herein are not limited to only the first preview mode and the second preview mode; multiple preview modes may also exist to select and process response modes for different lighting conditions, thereby improving the preview effect of the camera. Correspondingly, multiple brightness thresholds may also exist to determine which preview mode to select; no limitation is made here.
[0054] Please see Figure 2 , Figure 2 This is a schematic diagram of another camera preview process provided in an embodiment of this disclosure, such as... Figure 2 As shown, generating a target preview image for the camera based on the target preview mode and the initial preview image may include, but is not limited to, the following steps:
[0055] S21, in response to the target preview mode being set to the first preview mode, obtain the first target magnification of the camera.
[0056] To achieve the desired shooting effect, cameras generally have a zoom function, or zoom capability. Zooming a camera is like using a telescope to bring objects closer (magnify them); the higher the magnification, the closer you can get.
[0057] Currently, scaling is mainly achieved in two ways: the first is digital zoom, which magnifies the scene through software, similar to using a magnifying effect on a computer. The second is optical zoom, which uses a lens composed of multiple lenses to magnify the scene.
[0058] Digital zoom is performed by the back-end image signal processor (Image Signal Processor) for cropping and magnification, which consumes a significant amount of the Image Signal Processor's computing power. In other embodiments, ISZ mode can be used for zooming and hardware de-mosaic by the camera, greatly improving the resolution after zooming. However, ISZ mode suffers from an excessively high signal-to-noise ratio in low light, significantly impacting the quality of the generated preview image. Therefore, in the first preview mode, to obtain better preview image quality, the back-end Image Signal Processor is typically used for cropping and magnification.
[0059] It should be noted that the initial magnification level can be selected by the user. In practice, the initial magnification level can be determined by capturing the user's screen-stretching motion. Users can also select the initial magnification level using the zoom-in or zoom-out buttons on the camera.
[0060] Optionally, the user can also input the magnification of the first target into the camera.
[0061] Optionally, the first target magnification can also be preset and retrieved when previewing the image.
[0062] S22, perform pixel fusion on the pixels of the initial preview image based on the pixel fusion rate to obtain a fused preview image.
[0063] In this embodiment, the fusion rate can be various, such as 4-in-1, 9-in-1, 16-in-1, etc., which means merging 4, 9, or 16 pixels in the image into 1 pixel, reducing the signal-to-noise ratio of the image and improving the brightness of the image. On the other hand, since multiple pixels are merged into one pixel, the generated fused preview image has a lower resolution compared to the initial preview image.
[0064] The following example demonstrates a 1-to-4 fusion ratio. A four-color filter array algorithm can be used to fuse pixels in the initial preview image to obtain a fused preview image. The color filter array is a mosaic layer above the pixel sensor used to acquire color information of the image. General photoelectric sensors can only sense light intensity, not wavelength (color). Therefore, image sensors need to use color filters to acquire pixel color information. The green light filter in the filter is replaced with a transparent structure. The advantages of this approach are mainly reflected in higher light source intensity and the ability of dedicated frequency response technology to effectively improve image quality. Figure 3 As shown, the four-color filter array algorithm merges four adjacent pixels in the initial preview image into one pixel to improve the signal-to-noise ratio image quality of the pixel under low light conditions. At the same time, the number of pixels in the initial preview image is reduced due to pixel fusion.
[0065] In the embodiments disclosed herein, such as Figure 4 As shown, the resolution of the initial preview image is 8000x6000px, and the resolution of the fused preview image after processing based on the four-color filter array algorithm is 4000x3000px.
[0066] S23, the fused preview image is scaled based on the first target magnification factor to generate a first scaled preview image.
[0067] In this embodiment of the disclosure, before scaling the fused preview image, it is first necessary to perform image processing on the fused preview image using an image signal processor, and then scale the processed fused preview image.
[0068] It's important to note that the Image Signal Processor (ISP) is responsible for receiving the raw signal data from the image sensor in the entire camera imaging process. It can be understood as the first step in the camera's photo and video recording process, handling the image signal output from the image sensor. It holds a central and dominant position in the camera system and is a crucial component of the camera. Its main functions include linear correction, noise reduction, dead pixel removal, interpolation, white balance, and automatic exposure control. The ISP is essential for accurately reproducing scene details under various optical conditions. ISP technology largely determines the camera's image quality; it is the computational processing unit in the photo-taking process, essentially acting as the "brain" of the camera.
[0069] In this embodiment of the disclosure, in the first preview mode, the fused preview image is scaled by the ISP. This is generally done using the zoom ROI (zoom Region of Interest) method. This method employs a fixed focus, keeping the ROI consistent with its state before scaling and not changing with scaling. By fixing the focus, the image around the focus point is captured. This method offers fast focusing speed and stable image quality. After scaling, the resolution of the fused preview image will decrease based on the magnification of the first target.
[0070] For example, when the magnification of the first target is 2, after generating the fused preview image, it can be like this: Figure 4 As shown, the image signal processor first processes the fused preview image, and then the fused preview image is scaled based on the first target magnification factor. The resolution of the fused preview image is 4000X3000px, so only the target image with a resolution of 2000X1500px in the middle area is retained, so as to achieve the purpose of magnifying the fused preview image by 2 times.
[0071] S24, adjust the resolution of the first scaled preview image to a preset resolution to generate the target preview image.
[0072] In this embodiment of the disclosure, after obtaining the first zoomed preview image, the resolution of the first zoomed preview image can be compared with a preset resolution. If the resolution of the first zoomed preview image is greater than the preset resolution, the first zoomed preview image is reduced until the preset resolution is reached. If the resolution of the first zoomed preview image is less than the preset resolution, the first zoomed preview image is enlarged until the preset resolution is reached.
[0073] like Figure 4 As shown, the preset resolution is 1440X1080px, and the resolution of the first scaled preview image is 2000X1500px. The first scaled preview image needs to be reduced until it reaches the preset resolution in order to generate the target preview image.
[0074] It should be noted that the default resolution can be set by the user or is the system default; no restrictions are imposed here.
[0075] In this embodiment, firstly, in response to the target preview mode being a first preview mode, a first target magnification of the camera is obtained. Then, the initial preview image is pixel-fused to obtain a fused preview image. Next, the fused preview image is scaled based on the first target magnification to generate a first scaled preview image. Finally, the first scaled preview image is deformed to generate a target preview image of a preset resolution size. Therefore, by fusing the initial preview image pixel by pixel to obtain the fused preview image, the signal-to-noise ratio of the preview image in low-light environments can be reduced, improving image quality.
[0076] In low-light environments, the sensor can be switched to binning mode. In this mode, four adjacent pixels in the initial preview image are merged into one pixel, reducing the signal-to-noise ratio of the pixel under low-light conditions and increasing the image brightness, thereby improving the image quality of the preview image in low-light environments.
[0077] In some scenarios, pixel fusion of the initial preview image based on the pixel fusion rate does not produce a satisfactory fused preview image, which can affect subsequent image processing and degrade the camera preview quality. In this embodiment, image feature data of the fused preview image is first acquired. Then, the image level of the fused preview image is determined based on the image feature data and preset image feature data. If the image level is lower than a threshold, the pixel fusion rate is adjusted based on the image feature data and preset image feature data. Finally, based on the adjusted pixel fusion rate, the pixels of the initial preview image are re-fused until the optimal pixel fusion effect is achieved. This method of adjusting the pixel fusion rate is particularly effective in landscape images with relatively simple color variations, night scene photography, or dark images with small color differences, where pixel fusion does not significantly affect image sharpness.
[0078] Image feature data can include factors such as grayscale, sharpness, and resolution. Current technologies typically process image feature data using AI algorithms or by training models to output image quality levels. It should be noted that image quality levels can be categorized in various ways; no specific limitation is made here. The image quality level threshold is pre-set and can be adjusted according to actual conditions. For example, the image quality level threshold may differ under different weather conditions or lighting conditions.
[0079] Optionally, the image feature data, preset image feature data, and image level can also exist in a mapping table. By comparing the image feature data and the preset image feature data, the image level of the fused preview image is determined by looking up the table. This mapping table can be pre-set and stored in the storage space of the electronic device for easy retrieval when needed.
[0080] Once it is determined that the image level is less than the image level threshold, an analysis can be performed based on image feature data and preset image feature data to determine an adjustment scheme for the pixel fusion rate. For example, if the image sharpness is too high, it can be optimized by reducing the pixel fusion rate; if the image brightness is too low, it can be optimized by increasing the pixel fusion rate, and so on.
[0081] Please see Figure 5 , Figure 5 This is a schematic diagram of another camera preview process provided in an embodiment of this disclosure, such as... Figure 5 As shown, generating a target preview image for the camera based on the target preview mode and the initial preview image may include, but is not limited to, the following steps:
[0082] S51, in response to the target preview mode being set to the second preview mode, obtains the second target magnification of the camera.
[0083] For details on the implementation of step S51, please refer to the description of the relevant content in S21 in the above embodiments, which will not be repeated here.
[0084] S52, the initial preview image is scaled based on the second target magnification factor to generate a second scaled image.
[0085] In this embodiment of the disclosure, after the initial preview image is acquired in the second preview mode, it can be scaled by the sensor based on the second target magnification factor, without the need for scaling the initial preview image by the image signal processor. This can free up some of the computing power of the image signal processor, thereby allowing more computing power to be used for image processing.
[0086] Furthermore, this method of scaling via the sensor generates a second scaled image with higher resolution. In subsequent processing, compared to the scaling method using an image signal processor, the second scaled image generated by this method produces a better image quality, thereby improving the camera's preview effect in bright light environments.
[0087] like Figure 6 As shown, the initial preview image can be scaled directly based on the sensor. The resolution of the initial preview image is 4000x3000px when the initial preview image has a pixel size of 8000x6000px and the second target magnification factor is 2x.
[0088] S53, adjust the resolution of the first scaled preview image to a preset resolution to generate the target preview image.
[0089] In this embodiment of the disclosure, after obtaining the second scaled image, the second scaled preview image can first be processed based on the image signal processor.
[0090] After obtaining the second zoomed preview image, the resolution of the second zoomed preview image can be compared with the preset resolution. If the resolution of the second zoomed preview image is greater than the preset resolution, the second zoomed preview image is shrunk until it reaches the preset resolution. If the resolution of the second zoomed preview image is less than the preset resolution, the second zoomed preview image is enlarged until it reaches the preset resolution.
[0091] It should be noted that the preset resolution is pre-set and can be changed according to actual needs; no limitations are imposed here. Figure 6 As shown, the preset resolution is 1440x1080px, and the resolution of the first scaled preview image is 4000x3000px. The first scaled preview image needs to be reduced to reach the preset resolution in order to generate a target preview image of the preset resolution size.
[0092] In this embodiment, firstly, in response to the target preview mode being a second preview mode, a second target magnification factor of the camera is obtained. Then, the initial preview image is scaled based on the second target magnification factor to generate a second scaled image. Finally, the second scaled preview image is deformed to generate a target preview image of a preset resolution size. Therefore, in bright lighting conditions, the initial preview image is magnified by the sensor without requiring scaling by the image signal processor. This allows the image signal processor to allocate more computing power to image processing, and eliminates the need for pixel fusion of the initial preview image, thus improving the resolution of the target preview image.
[0093] In this embodiment, under bright light conditions, the CFA Sensor can be adjusted to sensor zoom (ISZ) mode. ISZ involves cropping and demosaicing by the camera, which significantly improves the resolution after scaling. In other embodiments, the CFA Sensor can be adjusted to full-size mode within binning mode. Hardware or software remosaic technology is used to restore the image to a high-resolution BAYER format. However, compared to ISZ mode, the resolution of the downscaled input image is only 1 / 4 that of the input image in ISZ mode, resulting in a significantly lower resolution for the final downscaled output image.
[0094] Figure 7 The figure illustrates the overall process of an embodiment of this disclosure. First, the camera is started and its preview process is executed. Then, the ambient brightness value of the camera's environment is acquired. Based on the ambient brightness value, it is determined whether the current environment is dark. If the current environment is dark, the system switches to a first preview mode; if the current environment is bright, it switches to a second preview mode. A target preview image is generated and displayed in the camera's preview area. Therefore, by acquiring the ambient brightness value and automatically selecting different target preview modes, the optimal image processing mode can be chosen for different ambient brightness values, thereby enhancing the camera's preview effect and improving the user experience.
[0095] Corresponding to the camera preview methods provided in the above embodiments, one embodiment of this disclosure also provides a camera preview device. Since the camera preview device provided in this disclosure corresponds to the camera preview methods provided in the above embodiments, the implementation methods of the above camera preview methods are also applicable to the camera preview device provided in this disclosure, and will not be described in detail in the following embodiments.
[0096] Please see Figure 8 This is a schematic diagram of the structure of a camera preview device 80 provided in an embodiment of this disclosure. Figure 8 The camera preview device 80 shown may include a startup module 81, an acquisition module 82, a generation module 83, and an execution module 84.
[0097] The startup module 81 is used to start the camera and execute the camera's preview process to acquire the initial preview image to be previewed.
[0098] The acquisition module 82 is used to acquire the ambient brightness value of the environment in which the camera is located.
[0099] The generation module 83 is used to generate a call instruction for the preview mode based on the ambient brightness value and the brightness threshold. The call instruction includes the target preview mode.
[0100] The execution module 84 is used to execute the call instruction, call the target preview mode, generate the target preview image of the camera based on the target preview mode and the initial preview image, and display the target preview image in the preview area of the camera.
[0101] In one embodiment of this disclosure, the generation module 83 is further configured to: compare the ambient brightness value with a brightness threshold; in response to the ambient brightness value being less than the brightness threshold, select a first preview mode from the candidate preview modes as the target preview mode, and generate a calling instruction based on the first preview mode; or in response to the ambient brightness value being greater than or equal to the brightness threshold, select a second preview mode from the candidate preview modes as the target preview mode, and generate a calling instruction based on the second preview mode.
[0102] In one embodiment of this disclosure, the execution module 84 is further configured to: in response to the target preview mode being a first preview mode, obtain a first target magnification of the camera; perform pixel fusion on the pixels of the initial preview image based on the pixel fusion rate to obtain a fused preview image; scale the fused preview image based on the first target magnification to generate a first scaled preview image; and deform the first scaled preview image to generate a target preview image of a preset resolution size.
[0103] In one embodiment of this disclosure, the execution module 84 is further configured to: acquire image feature data of the fused preview image; determine the image level of the fused preview image based on the image feature data and preset image feature data; adjust the pixel fusion rate based on the image feature data and preset image feature data in response to the image level being less than the image level threshold; and re-fuse the pixels of the initial preview image based on the adjusted pixel fusion rate.
[0104] In one embodiment of this disclosure, the execution module 84 is further configured to: perform pixel fusion on the initial preview image based on a four-color filter array algorithm to obtain a fused preview image.
[0105] In one embodiment of this disclosure, the execution module 84 is further configured to: in response to the target preview mode being a second preview mode, obtain a second target magnification of the camera; scale the initial preview image based on the second target magnification to generate a second scaled image; and adjust the resolution of the first scaled preview image to a preset resolution to generate a target preview image.
[0106] In one embodiment of this disclosure, the execution module 84 is further configured to: collect light information of the surrounding environment based on the photosensitive element to determine the ambient brightness value; or, acquire the screen brightness of the initial preview image and determine the ambient brightness value based on the screen brightness.
[0107] In one embodiment of this disclosure, the acquisition module 82 is further configured to: generate multiple candidate target preview images based on all candidate preview modes and the initial preview image; select the candidate target preview image with the highest resolution from the multiple candidate target preview images as the target preview image, and bind the preview mode corresponding to the candidate target preview image with the current ambient brightness value.
[0108] In this embodiment, the camera is first activated and its preview process is executed to acquire an initial preview image. Then, the ambient brightness value of the camera's environment is obtained. Next, based on the ambient brightness value and a brightness threshold, a preview mode invocation command is generated, including the target preview mode. Finally, the invocation command is executed to invoke the target preview mode, and a target preview image is generated based on the target preview mode and the initial preview image. This target preview image is then displayed in the camera's preview area. Therefore, by acquiring the ambient brightness value and automatically selecting different target preview modes, it is possible to acquire target preview images with better shooting effects under different brightness levels, thus improving the user experience.
[0109] Those skilled in the art will also understand that the various illustrative logical blocks and steps listed in the embodiments of this disclosure can be implemented by electronic hardware, computer software, or a combination of both. Whether such functionality is implemented in hardware or software depends on the specific application and the overall system design requirements. Those skilled in the art can implement the described functionality using various methods for each specific application, but such implementation should not be construed as exceeding the scope of protection of the embodiments of this disclosure.
[0110] To implement the above embodiments, this disclosure also proposes an electronic device 900, such as... Figure 9 As shown, the electronic device 900 includes: a processor 91 and a memory 92 communicatively connected to the processor. The memory 92 stores instructions that can be executed by at least one processor. The instructions are executed by at least one processor 91 to implement the firmware debugging method as described in the first aspect of this disclosure.
[0111] This disclosure also provides a readable storage medium having instructions stored thereon that, when executed by a computer, implement the functions of any of the above method embodiments.
[0112] This disclosure also provides a computer program product that, when executed by a computer, implements the functions of any of the above method embodiments.
[0113] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer programs. When the computer program is loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this disclosure are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer program can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program can be transferred from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., high-density digital video discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).
[0114] Those skilled in the art will understand that the various numerical designations such as "first," "second," etc., used in this disclosure are merely for the convenience of description and are not intended to limit the scope of the embodiments of this disclosure, nor do they indicate the order of events.
[0115] At least one of the features described in this disclosure can also be described as one or more, and multiple features can be two, three, four or more, and this disclosure does not impose any limitations. In the embodiments of this disclosure, for a technical feature, the technical features in that technical feature are distinguished by "first", "second", "third", "A", "B", "C" and "D", etc., and there is no sequential order or size order among the technical features described by "first", "second", "third", "A", "B", "C" and "D".
[0116] The correspondences shown in the tables of this disclosure can be configured or predefined. The values of the information in each table are merely examples and can be configured to other values; this disclosure is not limiting. When configuring the correspondences between information and parameters, it is not necessarily required to configure all the correspondences shown in each table. For example, the correspondences shown in some rows of the tables in this disclosure may not be configured. Furthermore, appropriate modifications and adjustments can be made based on the above tables, such as splitting, merging, etc. The names of the parameters shown in the headers of the above tables can also use other names that the communication device can understand, and the values or representations of the parameters can also be other values or representations that the communication device can understand. In the implementation of the above tables, other data structures can also be used, such as arrays, queues, containers, stacks, linear lists, pointers, linked lists, trees, graphs, structures, classes, heaps, hash tables, or hash tables, etc.
[0117] The predefined terms in this disclosure can be understood as defined, predefined, stored, pre-stored, pre-negotiated, pre-configured, solidified, or pre-burned.
[0118] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.
[0119] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0120] The above description is merely a specific embodiment of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this disclosure should be included within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims.
Claims
1. A camera preview method, characterized in that, include: Start the camera and execute the camera's preview process to acquire the initial preview image to be previewed; Obtain the ambient brightness value of the environment in which the camera is located; Based on the ambient brightness value and brightness threshold, a preview mode invocation instruction is generated, wherein the invocation instruction includes the target preview mode; The call instruction is executed to invoke the target preview mode, and a target preview image of the camera is generated based on the target preview mode and the initial preview image, and the target preview image is displayed in the preview area of the camera; The process of generating the target preview image for the camera based on the target preview mode and the initial preview image includes: In response to the target preview mode being the first preview mode, the first target magnification of the camera is obtained; The pixels of the initial preview image are fused based on the pixel fusion rate to obtain a fused preview image; The fused preview image is scaled based on the first target magnification factor to generate a first scaled preview image; Adjust the resolution of the first scaled preview image to a preset resolution to generate the target preview image.
2. The method according to claim 1, characterized in that, The step of generating a preview mode invocation instruction based on the ambient brightness value and brightness threshold, wherein the invocation instruction includes a target preview mode, including: Compare the ambient brightness value with the brightness threshold; In response to the ambient brightness value being less than a brightness threshold, a first preview mode is selected from candidate preview modes as the target preview mode, and the invocation command is generated based on the first preview mode; or In response to the ambient brightness value being greater than or equal to a brightness threshold, a second preview mode is selected from the candidate preview modes as the target preview mode, and a calling instruction is generated based on the second preview mode.
3. The method according to claim 1, characterized in that, The method further includes: Obtain the image feature data of the fused preview image; The image level of the fused preview image is determined based on the image feature data and preset image feature data; In response to the image level being less than an image level threshold, the pixel fusion rate is adjusted based on the image feature data and the preset image feature data; Based on the adjusted pixel fusion rate, the pixels of the initial preview image are re-fused.
4. The method according to claim 2, characterized in that, The process of generating the target preview image of the camera based on the target preview mode and the initial preview image further includes: In response to the target preview mode being the second preview mode, the second target magnification of the camera is obtained; The initial preview image is scaled based on the second target magnification to generate a second scaled image; Adjust the resolution of the first scaled preview image to a preset resolution to generate the target preview image.
5. The method according to claim 1, characterized in that, The step of obtaining the ambient brightness value of the environment in which the camera is located includes: The ambient light information is collected using a photosensitive element to determine the ambient brightness value; or... The brightness of the initial preview image is obtained, and the ambient brightness value is determined based on the image brightness.
6. The method according to claim 1, characterized in that, The method further includes: Multiple candidate target preview images are generated based on all candidate preview modes and the initial preview image; The candidate target preview image with the highest resolution is selected from multiple candidate target preview images as the target preview image, and the candidate preview mode corresponding to the candidate target preview image with the highest resolution is bound to the current ambient brightness value.
7. A camera preview device, characterized in that, include: The startup module is used to start the camera and execute the camera's preview process, and to acquire the initial preview image to be previewed; The acquisition module is used to acquire the ambient brightness value of the environment in which the camera is located; The generation module is used to generate a preview mode invocation instruction based on the ambient brightness value and brightness threshold, wherein the invocation instruction includes the target preview mode; An execution module is configured to execute the invocation instruction, invoke the target preview mode, generate a target preview image of the camera based on the target preview mode and the initial preview image, and display the target preview image in the preview area of the camera; The execution module is further configured to: In response to the target preview mode being the first preview mode, the first target magnification of the camera is obtained; The pixels of the initial preview image are fused based on the pixel fusion rate to obtain a fused preview image; The fused preview image is scaled based on the first target magnification factor to generate a first scaled preview image; Adjust the resolution of the first scaled preview image to a preset resolution to generate the target preview image.
8. An electronic device, characterized in that, Including memory and processor; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, thereby implementing the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium for storing instructions that, when executed, cause the method of any one of claims 1 to 6 to be implemented.
10. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Image display method and electronic device
CN105592254A
Image previewing method and device
CN106657780A
Image processing method and terminal
CN106911892A
Image processing method and device, mobile terminal and computer readable storage medium
CN110086993A
Image display parameter adjusting method and mobile terminal
CN111193874A