Image brightness alignment method, system and device of binocular camera and storage medium
By improving the image preprocessing and brightness adjustment methods of binocular cameras, the problem of inconsistent brightness caused by differences in camera manufacturing processes was solved, achieving natural image transitions and visual continuity, and improving the video viewing experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-03-27
AI Technical Summary
The inconsistent brightness caused by differences in camera manufacturing processes during image switching in binocular cameras can lead to visual abruptness and user discomfort.
By preprocessing the images from the main camera and the secondary camera, extracting brightness information, determining the number of target areas, generating a brightness histogram, and using a sliding window traversal to adjust the local brightness, the brightness of the secondary camera is adjusted based on the main camera.
It achieves precise recognition and control of screen brightness, avoiding overly bright or dark conditions, and improving visual continuity during screen transitions and the video viewing experience.
Smart Images

Figure CN121751005A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, specifically to an image brightness alignment method, system, device, and storage medium for a binocular camera. Background Technology
[0002] Binocular cameras can achieve a wider scene coverage by fusing the field of view information of two cameras, and therefore have broad application value in fields such as security monitoring and autonomous driving.
[0003] However, inconsistencies in image quality often occur during image switching in stereo cameras, with brightness differences being particularly significant. This is due to objective differences in the manufacturing processes of different cameras, resulting in variations in sensor characteristics and lens parameters. Furthermore, even under the same environmental conditions, different cameras exhibit significant differences in light capture efficiency and response characteristics: some cameras are more sensitive to strong light environments, easily leading to overexposure in bright scenes and loss of image detail; while others perform poorly in low-light environments, outputting images with insufficient brightness, making object outlines difficult to discern. When a stereo camera switches between different cameras, this brightness difference creates a noticeable visual jump, causing not only visual discomfort for the user but also affecting their overall judgment of the scene. Therefore, it is urgent to address the problem of sudden brightness changes during image switching in stereo cameras. Summary of the Invention
[0004] In view of the above-mentioned shortcomings of the prior art, this application provides an image brightness alignment method, system, device and storage medium for a binocular camera, which effectively solves the problem of sudden brightness changes during image switching in a binocular camera.
[0005] In a first aspect, this application provides an image brightness alignment method for a binocular camera, the binocular camera including a main camera and a secondary camera, the method comprising: Acquire a first image frame captured by the main camera and a second image frame captured by the secondary camera, wherein the first image frame is the last frame before the main camera is switched, and the second image frame is the first frame after the secondary camera is switched; Image preprocessing is performed on the first image frame and the second image frame respectively, and brightness information is extracted. The number of target region pairs is determined based on the brightness information of multiple target regions. If the number of target regions is less than the number threshold, a brightness histogram is generated based on the brightness information, and a brightness consistency processing is determined based on the brightness histogram. If it is determined that the brightness consistency processing will be performed, then based on the first image frame, the second image frame is traversed using a sliding window to perform local brightness adjustment, thereby obtaining a brightness-aligned image frame.
[0006] In an optional implementation, image preprocessing is performed on the first image frame and the second image frame respectively, and brightness information is extracted. The number of target region pairs is determined based on the brightness information of multiple target regions, including: Image preprocessing is performed on the first image frame and the second image frame respectively to obtain the first target image frame and the second target image frame; Extract the brightness information of the first target image frame and the second target image frame to obtain the first brightness information and the second brightness information; The number of target region pairs that meet the brightness consistency condition is determined based on the first brightness information and the second brightness information of each target region.
[0007] In an optional implementation, image preprocessing is performed on the first image frame and the second image frame respectively to obtain the first target image frame and the second target image frame, including: Denoising processing is performed on the first image frame and the second image frame respectively to obtain the first initial image frame and the second initial image frame; Automatic white balance processing and color correction matrix calibration are performed on the first initial image frame and the second initial image frame respectively to obtain the first target image frame and the second target image frame.
[0008] In an optional implementation, the brightness information of the first target image frame and the second target image frame is extracted to obtain first brightness information and second brightness information, including: The first target image frame and the second target image frame are converted into YUV format respectively, and the channel information of the luminance channel in the YUV space is extracted to obtain the first luminance information and the second luminance information.
[0009] In an optional implementation, determining the number of target region pairs that meet the brightness consistency condition based on the first brightness information and the second brightness information of each target region includes: The first target image frame and the second target image frame are divided into regions respectively to obtain multiple first target regions and multiple second target regions. The number of first target regions and second target regions is the same, and the corresponding first target regions and second target regions have the same position and size. The average brightness is calculated based on the first brightness information of each of the first target regions, and the average brightness is calculated based on the first brightness information of each of the second target regions. Calculate the difference between the average brightness values of each corresponding first target region and second target region to obtain multiple brightness differences; If the brightness difference is less than the brightness difference threshold, then the corresponding first target region and second target region are determined to meet the brightness consistency condition, and the number of target region pairs is obtained.
[0010] In an optional implementation, a luminance histogram is generated based on the luminance information, and a determination is made based on the luminance histogram whether to perform luminance consistency processing, including: A first luminance histogram is generated based on the luminance information corresponding to the first image frame, and a second luminance histogram is generated based on the luminance information corresponding to the second image frame. The first brightness histogram is divided into multiple pixel value regions according to pixel values to obtain the first pixel value region, and the second brightness histogram is divided into multiple pixel value regions according to pixel values to obtain the second pixel value region. The number of the first pixel value region and the second pixel value region are the same. Calculate the total number of pixels in each of the first pixel value regions and the second pixel value regions, and calculate the difference in the total number of pixels corresponding to the first pixel value regions and the second pixel value regions at the same position to obtain the difference in the total number of pixels; The number of target pixel value region pairs is obtained by counting the number of differences in the total number of pixels that are greater than the threshold. If the number of target pixel value region pairs is greater than the threshold, the brightness consistency processing is not performed. If the number of target pixel value region pairs is less than or equal to the threshold, the brightness consistency processing is performed.
[0011] In an optional implementation, using the first image frame as a reference, a sliding window is used to traverse the second image frames to perform local brightness adjustment to obtain a brightness-aligned image frame, including: Using the first image frame as a reference frame, the first image frame and the second image frame are traversed through the target sliding window; Calculate the average brightness of the target sliding window at each window position in the first image frame and the second image frame respectively to obtain the first average brightness and the second average brightness; Calculate the difference between the average brightness of the first brightness and the average brightness of the second brightness corresponding to each of the window positions; If the mean difference in brightness is less than or equal to the mean difference threshold, the brightness value in the window position corresponding to the first image frame is assigned to the window position corresponding to the second image frame. If the mean difference in brightness is greater than the mean difference threshold, the next window position judgment process is performed until all window positions are processed to obtain the brightness-aligned image frame.
[0012] Secondly, this application provides an image brightness alignment system for a binocular camera, the binocular camera including a main camera and a secondary camera, the system comprising: The image acquisition module is used to acquire a first image frame captured by the main camera and a second image frame captured by the secondary camera. The first image frame is the last frame before the main camera is switched, and the second image frame is the first frame after the secondary camera is switched. The image processing module is used to perform image preprocessing on the first image frame and the second image frame respectively, extract brightness information, and determine the number of target regions based on the brightness information of multiple target regions; The information judgment module is used to generate a brightness histogram based on the brightness information if the number of target area pairs is less than the number threshold, and determine whether to perform brightness consistency processing based on the brightness histogram. The brightness adjustment module is used to, if it is determined that the brightness consistency processing is to be performed, use the first image frame as a reference and traverse the second image frame through a sliding window to perform local brightness adjustment to obtain a brightness-aligned image frame.
[0013] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the image brightness alignment method for a binocular camera as described in the first aspect of this application.
[0014] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image brightness alignment method for a binocular camera as described in the first aspect of this application.
[0015] The image brightness alignment method, system, device, and storage medium for binocular cameras provided in this application achieve precise identification and control of image brightness differences by preprocessing the images from the main camera and the secondary camera, analyzing the average brightness of the target area, and determining a threshold. Simultaneously, a sliding window traversal is employed to dynamically adjust the local brightness of the secondary camera image based on the main camera image, ensuring natural image transitions while avoiding overly bright or dark phenomena. This significantly improves the visual continuity of binocular cameras during zooming or switching, enhancing the smoothness and realism of the video viewing experience, and is particularly suitable for applications requiring high image quality consistency, such as live streaming, security, and intelligent photography equipment. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a first schematic diagram of the image brightness alignment method for a binocular camera provided in this application embodiment; Figure 2 This is a second schematic diagram of the image brightness alignment method for a binocular camera provided in the embodiments of this application; Figure 3 This is a third schematic diagram of the image brightness alignment method for a binocular camera provided in this application embodiment; Figure 4 This is the fourth schematic diagram of the image brightness alignment method for a binocular camera provided in this application embodiment; Figure 5 This is a schematic diagram of the image brightness alignment system structure of a binocular camera provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0018] Explanation of key component symbols: 200. Image brightness alignment system for binocular camera; 210. Image acquisition module; 220. Image processing module; 230. Information judgment module; 240. Brightness adjustment module; 300. Electronic device; 310. Processor; 320. Communication interface; 330. Memory; 340. Communication bus. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be further described clearly and completely below with reference to the accompanying drawings of the embodiments. It should be noted that the described embodiments are merely some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0020] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of this application.
[0022] In stereo cameras, inconsistencies often arise during image transitions, with brightness variations being particularly prominent. These variations can lead to images that are too dark or too bright, resulting in incomplete image information. Different cameras vary in their manufacturing processes, sensor characteristics, and lens parameters, causing differences in their light capture and response capabilities, even in the same environment. Some cameras are sensitive to strong light, easily overexposing images and losing detail in bright scenes, while others perform poorly in low-light environments, producing images that are too dark and making it difficult to discern object outlines. When the camera switches between these cameras, these brightness differences become apparent, creating a jarring visual experience for the user and affecting their overall judgment of the scene. Therefore, it is urgent to address the issue of abrupt brightness changes during image transitions in stereo cameras to ensure complete image information representation.
[0023] Example 1 This application provides an image brightness alignment method for a binocular camera, which effectively solves the problem of sudden brightness changes during image switching in a binocular camera. Figure 1 This is a first schematic diagram of the image brightness alignment method for a binocular camera provided in this application embodiment, as shown below. Figure 1 As shown, the method includes the following steps: S100: Acquire the first image frame captured by the main camera and the second image frame captured by the secondary camera. The first image frame is the last frame before the main camera is switched, and the second image frame is the first frame after the secondary camera is switched.
[0024] In this embodiment, the binocular camera includes a main camera and a secondary camera, which respectively acquire a first image frame captured by the main camera and a second image frame captured by the secondary camera, wherein the first image frame is the last frame before the main camera switches, and the second image frame is the first frame after the secondary camera switches.
[0025] For example, the main camera has a focal length of 1X-2X, and the secondary camera has a focal length of 2X-5X. In ordinary outdoor scenes, when there is a need to zoom in on the image, there will be a switch between the main camera and the secondary camera. If the focal length changes from 1.5X to 2.5X, the camera will switch to the secondary camera. Since the time interval between the last frame before the main camera switch and the first frame before the secondary camera switch is the closest, if other frames were used, the scene environment might have changed significantly, making subsequent brightness comparison impossible. Therefore, the last frame before the main camera switch is used as the first image frame, and the first frame after the secondary camera switch is used as the second image frame.
[0026] S200: Perform image preprocessing on the first image frame and the second image frame respectively, extract brightness information, and determine the number of target region pairs based on the brightness information of multiple target regions.
[0027] Figure 2 This is a second schematic diagram of the image brightness alignment method for a binocular camera provided in this application embodiment, as shown below. Figure 2 As shown, the preprocessing for the first and second image frames specifically includes the following steps: S210. Perform image preprocessing on the first image frame and the second image frame respectively to obtain the first target image frame and the second target image frame.
[0028] In this embodiment of the application, a denoising algorithm is used to denoise the temporal and spatial noise in the first and second image frames respectively to obtain the first initial image frame and the second initial image frame, thereby making the noise levels of the first initial image frame and the second initial image frame similar.
[0029] Optionally, the denoising algorithm can be determined according to the actual scenario. Spatial domain denoising algorithms include, but are not limited to, box filtering, Gaussian filtering, median filtering and nonlocal mean filtering, etc. Temporal domain denoising algorithms include, but are not limited to, inter-frame averaging filtering, recursive filtering and motion-compensated temporal filtering, etc.
[0030] This application embodiment suppresses spatial and temporal noise in the images from the main camera and the secondary camera through noise reduction processing, effectively reducing the inconsistency in noise levels caused by sensor differences, improving the convergence of the two image frames in terms of brightness, texture and visual performance, providing a stable and comparable image basis for subsequent brightness consistency processing, and enhancing the smooth and natural effect when switching between scenes.
[0031] In the embodiments of this application, automatic white balance processing and color correction matrix calibration can be performed on the first initial image frame and the second initial image frame respectively to obtain the first target image frame and the second target image frame.
[0032] For example, automatic white balance processing and color correction matrix calibration can eliminate color deviations between the main and secondary cameras caused by differences in sensors, lenses, or light sources. Automatic white balance processing ensures that both cameras accurately reproduce neutral colors under different lighting conditions, avoiding overly warm or cool tones. Color correction matrix calibration corrects color channel responses through matrix transformation, ensuring consistent color output in the same scene. Combined with unified adjustments to parameters such as saturation and brightness, this allows for a high degree of matching in color performance, color reproduction, and visual style between the main and secondary cameras under objective conditions. This calibration process lays the foundation for subsequent brightness consistency processing, preventing color differences from interfering with brightness judgment and improving the smoothness and naturalness of the image when switching between the two cameras.
[0033] S220. Extract the brightness information of the first target image frame and the second target image frame to obtain the first brightness information and the second brightness information.
[0034] In this embodiment of the application, the first target image frame and the second target image frame are converted into YUV format respectively, and the channel information of the luminance channel in the YUV space is extracted to obtain the first luminance information and the second luminance information.
[0035] Specifically, after converting the first and second target image frames into YUV format, the Y channel, i.e., the luminance channel, is extracted to separate pure luminance information unrelated to color. The Y channel reflects the brightness distribution of the image, avoiding interference from the U / V chrominance channels in luminance judgment, which is beneficial for accurately assessing the consistency of the two cameras in light response.
[0036] S230. Determine the number of target area pairs that meet the brightness consistency condition based on the first brightness information and the second brightness information of each target area.
[0037] In this embodiment of the application, the first target image frame and the second target image frame are firstly divided into regions to obtain multiple first target regions and multiple second target regions. The number of first target regions and second target regions are the same, and the positions and sizes of the corresponding first target regions and second target regions are the same.
[0038] For example, nine position coordinates are selected in the first target image frame, and nine rectangular regions of the same size are divided around these nine position coordinates to obtain nine first target regions, namely ROI1-1, ROI1-2, ..., ROI1-9. Similarly, nine rectangular regions of the same size as the rectangular regions in the first target image frame are divided around these nine position coordinates to obtain nine second target regions, namely ROI2-1, ROI2-2, ..., ROI2-9.
[0039] Then, the average brightness is calculated based on the first brightness information of each first target area, and the average brightness is calculated based on the first brightness information of each second target area.
[0040] In this embodiment of the application, the average brightness value of the target area can be obtained by dividing the sum of the pixel values of the corresponding target area by the number of pixels in the area.
[0041] Then, the difference between the average brightness values of the corresponding first target region and the second target region is calculated to obtain multiple brightness differences.
[0042] For example, the difference in the average brightness of the second first target region ROI1-2 in the first target image frame and the second second target region ROI2-2 in the corresponding second target image frame is calculated to obtain the brightness difference C2 between ROI1-2 and ROI2-2. Similarly, nine brightness differences can be obtained, corresponding to C1, C2, ..., C9 respectively.
[0043] Finally, if the brightness difference is less than the brightness difference threshold, the corresponding first target area and second target area are determined to meet the brightness consistency condition, and the number of target area pairs is obtained.
[0044] In this embodiment, by comparing each brightness difference value with a preset brightness difference threshold, the brightness consistency of each target area can be quantitatively determined. This brightness difference threshold can be set according to the actual scene. If the brightness difference value is greater than or equal to the brightness difference threshold, it indicates a significant brightness difference in the target area, potentially indicating exposure deviation or a sudden environmental change. If the brightness difference value is less than the brightness difference threshold, it is considered that the brightness is close, meeting the brightness alignment condition. Counting the number of target area pairs that meet the brightness alignment condition can be used to comprehensively evaluate the alignability of the main camera and secondary camera images.
[0045] For example, if 5 out of 9 brightness differences are less than the brightness difference threshold, it means that the number of target area pairs is 5.
[0046] The embodiments of this application establish a basis for subsequent brightness consistency processing by determining the quantity of the target area, thus avoiding image quality degradation caused by forced correction in cases of severe mismatch.
[0047] S300. If the number of target area pairs is less than the number threshold, a brightness histogram is generated based on the brightness information, and a brightness consistency processing is determined based on the brightness histogram.
[0048] In this embodiment, the quantity threshold can be set according to the actual scenario. For example, if the quantity threshold is set to 5 and the number of target area pairs is 4, a brightness histogram is generated based on the brightness information. The brightness histogram is then used to determine whether the brightness difference between the main camera and the secondary camera is within the allowable range, i.e., whether brightness consistency processing can be performed. Figure 3 This is a third schematic diagram of the image brightness alignment method for a binocular camera provided in this application embodiment, as shown below. Figure 3 As shown, the threshold determination of image brightness information specifically includes the following steps: S310. Generate a first brightness histogram based on the brightness information corresponding to the first image frame, and generate a second brightness histogram based on the brightness information corresponding to the second image frame.
[0049] In this embodiment, based on the brightness information corresponding to the first image frame, the brightness value of each pixel is traversed, and the 256 gray levels from 0 to 255 are counted. The number of pixels corresponding to each level is recorded to form a first brightness histogram. This histogram comprehensively reflects the overall brightness distribution characteristics of the image, such as whether it is too dark, too bright, or has a certain contrast. Similarly, a second brightness histogram can be obtained based on the brightness information corresponding to the first image frame.
[0050] S320. Divide the first brightness histogram into multiple pixel value regions according to pixel values to obtain the first pixel value region, and divide the second brightness histogram into multiple pixel value regions according to pixel values to obtain the second pixel value region. The number of the first pixel value region and the second pixel value region are the same.
[0051] For example, the first brightness histogram is divided into 32 equal pixel value regions according to the pixel value to obtain 32 first pixel value regions, and the second brightness histogram is divided into 32 equal pixel value regions according to the pixel value to obtain 32 second pixel value regions.
[0052] S330. Calculate the total number of pixels in each first pixel value region and second pixel value region, and calculate the difference between the total number of pixels in the first pixel value region and the second pixel value region at the same position to obtain the difference in the total number of pixels.
[0053] In this embodiment of the application, the total number of pixels in each first pixel value region is first calculated, then the total number of pixels in each second pixel value region is calculated, and then the difference between the total number of pixels in the corresponding first pixel value region and second pixel value region is calculated to obtain the difference in the total number of pixels.
[0054] For example, calculate the total number of pixels in the 10th first pixel value region among the 32 first pixel value regions, and then calculate the total number of pixels in the 10th second pixel value region among the 32 second pixel value regions. Subtract the two total number of pixels to obtain the difference between the total number of pixels in the 10th first pixel value region and the 10th second pixel value region. Similarly, the total number of pixels among the 32 regions can be obtained.
[0055] S340. Count the number of pixel value differences that are greater than the pixel value difference threshold, and obtain the number of target pixel value region pairs. If the number of target pixel value region pairs is greater than the pixel value region pair threshold, then no brightness consistency processing is performed. If the number of target pixel value region pairs is less than or equal to the pixel value region pair threshold, then brightness consistency processing is performed.
[0056] In this embodiment, the pixel total difference threshold can be set according to the actual scenario. The smaller the pixel total difference threshold, the finer the comparison. The number of pixel total differences greater than the pixel total difference threshold is counted to obtain the number of target pixel value region pairs. For example, if there are 4 pixel total differences greater than the pixel total difference threshold, the number of target pixel value region pairs is 4; if there are 10 pixel total differences greater than the pixel total difference threshold, the number of target pixel value region pairs is 10.
[0057] Furthermore, if the number of target pixel value pairs is greater than the pixel value pair threshold, then no brightness consistency processing is performed; if the number of target pixel value pairs is less than or equal to the pixel value pair threshold, then brightness consistency processing is performed.
[0058] For example, the total number of pixel difference threshold is usually less than the total number of pixel value regions; for instance, the total number of pixel difference threshold can be set to 5. When the number of target pixel value regions is 4, brightness consistency processing is performed; when the number of target pixel value regions is 10, brightness consistency processing is not performed.
[0059] This application embodiment uses a luminance histogram for threshold determination, which quantifies the difference in luminance distribution between the main camera and the secondary camera, effectively identifying issues such as excessively dark, excessively bright, or out-of-sync images. Through segmented comparison and further threshold determination, it ensures that luminance alignment is only initiated when the difference is controllable, improving processing accuracy and system robustness, avoiding miscalibration, and ensuring natural and smooth image quality during video switching.
[0060] S400. If it is determined that brightness consistency processing is to be performed, then the first image frame is used as a reference, and the local brightness is adjusted by traversing the second image frame through a sliding window to obtain a brightness-aligned image frame.
[0061] Figure 4 This is the fourth schematic diagram of the image brightness alignment method for a binocular camera provided in this application embodiment, as shown below. Figure 4As shown, image brightness consistency alignment specifically includes the following steps: S410. Using the first image frame as a reference frame, traverse the first image frame and the second image frame through the target sliding window.
[0062] As an optional implementation of this application, the first image frame and the second image frame are simultaneously divided into multiple grid regions of the same size. Taking the first image frame as a reference, a 5×5 target sliding window can be used to traverse the local regions of the first image frame and the second image frame respectively, covering the entire frame image.
[0063] S420. Calculate the average brightness of the target sliding window at each window position in the first image frame and the second image frame respectively, and obtain the first average brightness and the second average brightness.
[0064] In this embodiment of the application, for each window position, the brightness channel information of the corresponding area of the first image frame and the second image frame is extracted, the average brightness is calculated, and the first average brightness and the second average brightness are obtained.
[0065] S430. Calculate the difference between the average brightness of the first brightness value and the average brightness value of the second brightness value corresponding to each window position.
[0066] The difference between the first and second average brightness values of the corresponding areas at each window position is calculated to obtain the average brightness difference for each window position.
[0067] S440. If the average difference in brightness is less than or equal to the average difference threshold, then the brightness value in the window position corresponding to the first image frame is assigned to the window position corresponding to the second image frame. If the average difference in brightness is greater than the average difference threshold, then the next window position judgment process is performed until all window positions are processed to obtain a brightness-aligned image frame.
[0068] In this embodiment, the mean difference threshold can be set according to the actual scene. If the mean difference in brightness is less than or equal to the mean difference threshold, it indicates that the brightness performance of the two cameras in this local area is similar, and there is a basis for alignment. In this case, the brightness value of the window position corresponding to the first image frame is directly assigned to the window position area corresponding to the second image frame to achieve brightness alignment. If the mean difference in brightness is greater than the mean difference threshold, it indicates that there is a significant brightness difference in this local position, which may be caused by dynamic changes in the scene, lens occlusion, or exposure differences. In this case, brightness alignment processing is not performed, and the original brightness information of the second image frame is retained to avoid introducing artificial distortions such as excessive brightness or darkness. The judgment and processing of the next window position is performed sequentially until the processing of each window position is completed, and a brightness-aligned image frame can be obtained.
[0069] This application's embodiments, through local comparison and selective compensation, enhance the robustness of the algorithm while ensuring overall brightness consistency, preventing image quality degradation caused by forced global alignment. After traversal, the brightness distribution of the secondary camera image frames will be closer to that of the primary camera image frames, thereby achieving a natural and smooth visual transition when switching cameras, effectively improving the user experience of binocular cameras in applications such as live streaming and surveillance.
[0070] Example 2 Based on the same technical concept as Embodiment 1 above, this application provides an image brightness alignment system for a binocular camera, which includes a main camera and a secondary camera. Figure 5 This is a schematic diagram of the image brightness alignment system structure of a binocular camera provided in an embodiment of this application, as shown below. Figure 5 As shown, the image brightness alignment system 200 of the binocular camera includes: The image acquisition module 210 is used to acquire a first image frame captured by the main camera and a second image frame captured by the secondary camera. The first image frame is the last frame before the main camera switches, and the second image frame is the first frame after the secondary camera switches.
[0071] The image processing module 220 is used to perform image preprocessing on the first image frame and the second image frame respectively, extract brightness information, and determine the number of target regions based on the brightness information of multiple target regions.
[0072] The information judgment module 230 is used to generate a brightness histogram based on the brightness information if the number of target area pairs is less than the number threshold, and to determine whether to perform brightness consistency processing based on the brightness histogram.
[0073] The brightness adjustment module 240 is used to adjust the local brightness of the second image frame by using a sliding window to traverse the first image frame as a reference, if it is determined that brightness consistency processing is to be performed, so as to obtain a brightness-aligned image frame.
[0074] The image brightness alignment system for binocular cameras provided in this application significantly improves the visual continuity of binocular cameras during zooming or switching, enhances the smoothness and realism of video viewing experience, and is especially suitable for application scenarios with high requirements for image quality consistency, such as live streaming, security and intelligent photography equipment.
[0075] It is understood that the implementation method of the image brightness alignment method of the binocular camera in Embodiment 1 above is also applicable to this embodiment and can achieve the same technical effect, so it will not be described again here.
[0076] Example 3 Based on the same concept, this application also provides an electronic device. Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 6 As shown, the electronic device 300 may include a processor 310, a communication interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other via the communication bus 340. The processor 310 can call logical instructions in the memory 330 to execute the steps of the image brightness alignment method for the binocular camera as described in the above embodiments. For example, this includes: S100: Acquire the first image frame captured by the main camera and the second image frame captured by the secondary camera. The first image frame is the last frame before the main camera is switched, and the second image frame is the first frame after the secondary camera is switched. S200: Perform image preprocessing on the first image frame and the second image frame respectively, extract brightness information, and determine the number of target region pairs based on the brightness information of multiple target regions; S300. If the number of target area pairs is less than the number threshold, a brightness histogram is generated based on the brightness information, and a brightness consistency processing is determined based on the brightness histogram. S400. If it is determined that brightness consistency processing is to be performed, then the first image frame is used as a reference, and the local brightness is adjusted by traversing the second image frame through a sliding window to obtain a brightness-aligned image frame.
[0077] The processor 310 can be a central processing unit (CPU). The processor can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips.
[0078] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0079] The memory 330 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created by the processor, etc. Furthermore, the memory may include high-speed random access memory and non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include memory remotely located relative to the processor, which can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0080] Example 4 Based on the same concept, embodiments of this application also provide a computer-readable storage medium storing a computer program containing at least one piece of code executable by a master control device to control the master control device to implement the steps of the image brightness alignment method for a binocular camera as described in the above embodiments. For example, it includes: S100: Acquire the first image frame captured by the main camera and the second image frame captured by the secondary camera. The first image frame is the last frame before the main camera is switched, and the second image frame is the first frame after the secondary camera is switched. S200: Perform image preprocessing on the first image frame and the second image frame respectively, extract brightness information, and determine the number of target region pairs based on the brightness information of multiple target regions; S300. If the number of target area pairs is less than the number threshold, a brightness histogram is generated based on the brightness information, and a brightness consistency processing is determined based on the brightness histogram. S400. If it is determined that brightness consistency processing is to be performed, then the first image frame is used as a reference, and the local brightness is adjusted by traversing the second image frame through a sliding window to obtain a brightness-aligned image frame.
[0081] Based on the same technical concept, this application also provides a computer program, which, when executed by a main control device, is used to implement the above-described method embodiments.
[0082] The computer program may be stored, in whole or in part, on a computer-readable storage medium packaged with the processor, or in part or in whole on a memory not packaged with the processor.
[0083] Based on the same technical concept, this application also provides a processor for implementing the above-described method embodiments. The processor can be a chip.
[0084] In summary, the image brightness alignment method, system, device, and storage medium for binocular cameras provided in this application achieve precise identification and control of image brightness differences by preprocessing the images from the main camera and the secondary camera, analyzing the average brightness of the target area, and determining a threshold. Simultaneously, by employing a sliding window traversal, the local brightness of the secondary camera image is dynamically adjusted based on the main camera image, ensuring a natural transition while avoiding overly bright or dark images. This significantly improves the visual continuity of binocular cameras during zooming or switching, enhancing the smoothness and realism of the video viewing experience, and is particularly suitable for applications requiring high image quality consistency, such as live streaming, security, and intelligent photography equipment.
[0085] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0086] The embodiments described above are merely examples 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 modifications and improvements all fall within the protection scope of this application.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for image brightness alignment using a binocular camera, characterized in that, The binocular camera includes a main camera and a secondary camera, and the method includes: Acquire a first image frame captured by the main camera and a second image frame captured by the secondary camera, wherein the first image frame is the last frame before the main camera is switched, and the second image frame is the first frame after the secondary camera is switched; Image preprocessing is performed on the first image frame and the second image frame respectively, and brightness information is extracted. The number of target region pairs is determined based on the brightness information of multiple target regions. If the number of target regions is less than the number threshold, a brightness histogram is generated based on the brightness information, and a brightness consistency processing is determined based on the brightness histogram. If it is determined that the brightness consistency processing will be performed, then based on the first image frame, the second image frame is traversed using a sliding window to perform local brightness adjustment, thereby obtaining a brightness-aligned image frame.
2. The image brightness alignment method for a binocular camera according to claim 1, characterized in that, Image preprocessing is performed on the first image frame and the second image frame respectively, and brightness information is extracted. The number of target region pairs is determined based on the brightness information of multiple target regions, including: Image preprocessing is performed on the first image frame and the second image frame respectively to obtain the first target image frame and the second target image frame; Extract the brightness information of the first target image frame and the second target image frame to obtain the first brightness information and the second brightness information; The number of target region pairs that meet the brightness consistency condition is determined based on the first brightness information and the second brightness information of each target region.
3. The image brightness alignment method for a binocular camera according to claim 2, characterized in that, Image preprocessing is performed on the first image frame and the second image frame respectively to obtain the first target image frame and the second target image frame, including: Denoising processing is performed on the first image frame and the second image frame respectively to obtain the first initial image frame and the second initial image frame; Automatic white balance processing and color correction matrix calibration are performed on the first initial image frame and the second initial image frame respectively to obtain the first target image frame and the second target image frame.
4. The image brightness alignment method for a binocular camera according to claim 3, characterized in that, Extracting the brightness information of the first target image frame and the second target image frame to obtain first brightness information and second brightness information includes: The first target image frame and the second target image frame are converted into YUV format respectively, and the channel information of the luminance channel in the YUV space is extracted to obtain the first luminance information and the second luminance information.
5. The image brightness alignment method for a binocular camera according to claim 4, characterized in that, Based on the first brightness information and the second brightness information of each target region, the number of target region pairs that meet the brightness consistency condition is determined, including: The first target image frame and the second target image frame are divided into regions respectively to obtain multiple first target regions and multiple second target regions. The number of first target regions and second target regions is the same, and the corresponding first target regions and second target regions have the same position and size. The average brightness is calculated based on the first brightness information of each of the first target regions, and the average brightness is calculated based on the first brightness information of each of the second target regions. Calculate the difference between the average brightness values of each corresponding first target region and second target region to obtain multiple brightness differences; If the brightness difference is less than the brightness difference threshold, then the corresponding first target region and second target region are determined to meet the brightness consistency condition, and the number of target region pairs is obtained.
6. The image brightness alignment method for a binocular camera according to claim 1, characterized in that, Generate a luminance histogram based on the luminance information, and determine whether to perform luminance consistency processing based on the luminance histogram, including: A first luminance histogram is generated based on the luminance information corresponding to the first image frame, and a second luminance histogram is generated based on the luminance information corresponding to the second image frame. The first brightness histogram is divided into multiple pixel value regions according to pixel values to obtain the first pixel value region, and the second brightness histogram is divided into multiple pixel value regions according to pixel values to obtain the second pixel value region. The number of the first pixel value region and the second pixel value region are the same. Calculate the total number of pixels in each of the first pixel value regions and the second pixel value regions, and calculate the difference in the total number of pixels corresponding to the first pixel value regions and the second pixel value regions at the same position to obtain the difference in the total number of pixels; The number of target pixel value region pairs is obtained by counting the number of differences in the total number of pixels that are greater than the threshold. If the number of target pixel value region pairs is greater than the threshold, the brightness consistency processing is not performed. If the number of target pixel value region pairs is less than or equal to the threshold, the brightness consistency processing is performed.
7. The image brightness alignment method for a binocular camera according to claim 1, characterized in that, Using the first image frame as a reference, a sliding window is used to traverse the second image frame to perform local brightness adjustment, resulting in a brightness-aligned image frame, including: Using the first image frame as a reference frame, the first image frame and the second image frame are traversed through the target sliding window; Calculate the average brightness of the target sliding window at each window position in the first image frame and the second image frame respectively to obtain the first average brightness and the second average brightness; Calculate the difference between the average brightness of the first brightness and the average brightness of the second brightness corresponding to each of the window positions; If the mean difference in brightness is less than or equal to the mean difference threshold, the brightness value in the window position corresponding to the first image frame is assigned to the window position corresponding to the second image frame. If the mean difference in brightness is greater than the mean difference threshold, the next window position judgment process is performed until all window positions are processed to obtain the brightness-aligned image frame.
8. An image brightness alignment system for a binocular camera, characterized in that, The binocular camera includes a main camera and a secondary camera, and the system includes: The image acquisition module is used to acquire a first image frame captured by the main camera and a second image frame captured by the secondary camera. The first image frame is the last frame before the main camera is switched, and the second image frame is the first frame after the secondary camera is switched. The image processing module is used to perform image preprocessing on the first image frame and the second image frame respectively, extract brightness information, and determine the number of target regions based on the brightness information of multiple target regions; The information judgment module is used to generate a brightness histogram based on the brightness information if the number of target area pairs is less than the number threshold, and determine whether to perform brightness consistency processing based on the brightness histogram. The brightness adjustment module is used to, if it is determined that the brightness consistency processing is to be performed, use the first image frame as a reference and traverse the second image frame through a sliding window to perform local brightness adjustment to obtain a brightness-aligned image frame.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the image brightness alignment method for a binocular camera as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the image brightness alignment method for a binocular camera as described in any one of claims 1-7.