Image processing method, image processing device, electronic device, and storage medium

By calculating the color component ratio and cosine similarity of the cameras, the color of the second camera is corrected, solving the problem of color jumps in multi-camera devices and achieving color consistency and reduced power consumption.

CN116704049BActive Publication Date: 2026-05-05GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2022-02-22
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

In multi-camera devices, color jumps can easily occur during zooming, making it difficult to achieve color consistency.

Method used

The cosine similarity is determined by calculating the ratio of the color components of the first camera and the second camera. When the cosine similarity is greater than a preset similarity, the image color of the second camera is corrected using the calculation result of the first camera.

Benefits of technology

It achieves color consistency during camera switching, avoids color jumps, reduces power consumption, and improves image processing accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116704049B_ABST
    Figure CN116704049B_ABST
Patent Text Reader

Abstract

This application discloses an image processing method, apparatus, electronic device, and computer-readable storage medium. The image processing method includes: determining a first calculation result based on the color component ratio of a first image captured by a first camera; determining a second calculation result based on the color component ratio of a second image captured by a second camera; determining a cosine similarity between the first calculation result and the second calculation result; and when the cosine similarity is greater than a preset similarity, processing the second image based on the first calculation result to correct the color of the second image. In the above-mentioned image processing method, apparatus, electronic device, and storage medium, when the cosine similarity between the first calculation result and the second calculation result is greater than a preset similarity, it indicates that the color temperatures of the first image and the second image are relatively close. Therefore, the second image can be processed based on the first calculation result of the first image to correct the color of the second image, thereby making the colors of the first camera and the second camera substantially consistent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to image processing technology, and in particular to an image processing method, an image processing apparatus, an electronic device, and a computer-readable storage medium. Background Technology

[0002] In related technologies, electronic devices may include multiple cameras, such as a main camera, a wide-angle camera, and a telephoto camera. During the zooming process of multiple cameras, color abrupt changes can occur, making it difficult for the colors captured by the multiple cameras to be consistent. Summary of the Invention

[0003] Embodiments of this application provide an image processing method, an image processing apparatus, an electronic device, and a computer-readable storage medium.

[0004] The image processing method of this application includes: determining a first calculation result based on the color component ratio of a first image captured by a first camera; determining a second calculation result based on the color component ratio of a second image captured by a second camera; determining the cosine similarity between the first calculation result and the second calculation result; and when the cosine similarity is greater than a preset similarity, processing the second image based on the first calculation result to correct the color of the second image.

[0005] The image processing apparatus of this application includes a first processing module, a second processing module, a third processing module, and a fourth processing module. The first processing module is used to determine a first calculation result based on the color component ratios of a first image captured by a first camera. The second processing module is used to determine a second calculation result based on the color component ratios of a second image captured by a second camera. The third processing module is used to determine the cosine similarity between the first calculation result and the second calculation result. The fourth processing module is used to process the second image according to the first calculation result to correct the color of the second image when the cosine similarity is greater than a preset similarity.

[0006] The electronic device according to embodiments of this application includes one or more processors and a memory. The memory stores a computer program. When the computer program is executed by the processor, it implements the steps of the image processing method described in the above embodiments.

[0007] The computer-readable storage medium of the present application embodiment stores a computer program, characterized in that, when the program is executed by a processor, it implements the steps of the image processing method described in the above embodiment.

[0008] In the above-mentioned image processing method, image processing device, electronic device, and computer-readable storage medium, when the cosine similarity between the first calculation result and the second calculation result is greater than the preset similarity, it indicates that the color temperature of the first image and the second image are relatively close. Therefore, the second image can be processed according to the first calculation result of the first image to correct the color of the second image, so that the colors of the first camera and the second camera are basically consistent and no color jump will occur during camera switching.

[0009] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0010] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, wherein:

[0011] Figure 1 This is a schematic flowchart of an image processing method according to certain embodiments of this application;

[0012] Figure 2 This is a schematic diagram of an electronic device according to certain embodiments of this application;

[0013] Figure 3 This is a schematic diagram of an image processing apparatus according to certain embodiments of this application;

[0014] Figure 4 This is a schematic flowchart of an image processing method according to certain embodiments of this application;

[0015] Figure 5 This is a schematic diagram of the third processing module in some embodiments of this application;

[0016] Figure 6 This is a schematic flowchart of an image processing method according to certain embodiments of this application;

[0017] Figure 7 This is a schematic diagram of the first processing module in some embodiments of this application;

[0018] Figure 8 This is a schematic flowchart of an image processing method according to certain embodiments of this application;

[0019] Figure 9 This is a schematic diagram of the second processing module in some embodiments of this application;

[0020] Figure 10 This is a schematic flowchart of an image processing method according to certain embodiments of this application;

[0021] Figure 11This is a schematic diagram of an image processing apparatus according to certain embodiments of this application;

[0022] Figure 12 This is a schematic flowchart of an image processing method according to certain embodiments of this application;

[0023] Figure 13 This is a schematic diagram of an image processing apparatus according to certain embodiments of this application;

[0024] Figure 14 This is a schematic flowchart of an image processing method according to certain embodiments of this application;

[0025] Figure 15 This is a schematic diagram of an image processing apparatus according to certain embodiments of this application;

[0026] Figure 16 These are schematic diagrams of a scene, showing the first and second images of certain embodiments of this application;

[0027] Figure 17 This is a schematic diagram of an image processing method according to certain embodiments of this application. Detailed Implementation

[0028] The embodiments of this application are described in detail below. These embodiments are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.

[0029] In the description of the embodiments of this application, 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 indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0030] In related technologies, the current mobile phone industry is vigorously promoting the use of multiple cameras, with optical zoom being of paramount importance. Due to size limitations, actual zooming is accomplished by multiple cameras working in succession, which brings many problems. One of these problems is that color jumps can occur during the zooming process of multiple cameras, making it difficult to achieve consistency in the colors captured by the multiple cameras.

[0031] Please see Figure 1 and Figure 2 The image processing method of this application includes:

[0032] 01: Determine the first calculation result based on the color component ratio of the first image captured by the first camera 10;

[0033] 02: Determine the second calculation result based on the color component ratio of the second image captured by the second camera 20;

[0034] 03: Determine the cosine similarity between the first and second calculation results;

[0035] 04: When the cosine similarity is greater than the preset similarity, the second image is processed according to the first calculation result to correct the color of the second image.

[0036] Please see Figure 2 and Figure 3 The image processing apparatus 30 of this application includes a first processing module 31, a second processing module 32, a third processing module 33 and a fourth processing module 34.

[0037] The image processing method of this application can be implemented by the image processing apparatus 30 of this embodiment. Step 01 can be implemented by the first processing module 31, step 02 by the second processing module 32, step 03 by the third processing module 33, and step 04 by the fourth processing module 34. That is, the first processing module 31 can be used to determine a first calculation result based on the color component ratio of the first image captured by the first camera 10. The second processing module 32 can be used to determine a second calculation result based on the color component ratio of the second image captured by the second camera 20. The third processing module 33 can be used to determine the cosine similarity between the first and second calculation results. The fourth processing module 34 can be used to process the second image according to the first calculation result to correct the color of the second image when the cosine similarity is greater than a preset similarity.

[0038] In the above image processing method and image processing device 30, when the cosine similarity between the first calculation result and the second calculation result is greater than the preset similarity, it indicates that the color temperature of the first image and the second image are relatively close. Therefore, the second image can be processed according to the first calculation result of the first image to correct the color of the second image, so that the colors of the first camera 10 and the second camera 20 are basically consistent, and there will be no color jump during the camera switching process.

[0039] In some embodiments, the electronic device 100 may include smartphones, tablets, smartwatches, smart bracelets, and other devices, without specific limitations. The electronic device 100 described in this application is exemplified using a smartphone as an example and should not be construed as a limitation of this application.

[0040] Specifically, the electronic device 100 may include a first camera 10 and a second camera 20, which can acquire scene information to obtain a first image and a second image. In one embodiment, the electronic device 100 may include multiple cameras, such as a main camera, a wide-angle camera, and a telephoto camera. The first camera 10 may be any one of the main camera, the wide-angle camera, and the telephoto camera, and the second camera 20 may be another one of the main camera, the wide-angle camera, and the telephoto camera. When switching cameras (e.g., performing optical zoom), the camera before switching can be used as the first camera 10, and the camera after switching can be used as the second camera 20.

[0041] This application uses cosine similarity to measure whether the first calculation result of the first camera 10 is used to process the image of the second camera 20. Compared with measurement methods such as Euclidean distance, this application can more accurately determine whether the color temperatures of the two are similar, and has a significant advantage in maintaining color temperature. The preset similarity can be adjusted. For example, when receiving an adjustment command from the user, the preset similarity can be adjusted according to the adjustment command. The preset similarity can also be set in stages according to the ambient color temperature (CCT) and ambient brightness. For example, the first ambient color temperature range and the first ambient brightness range can correspond to the first preset similarity, the second ambient color temperature range and the second ambient brightness range can correspond to the second preset similarity, and the third ambient color temperature range and the third ambient brightness range can correspond to the third preset similarity, etc.

[0042] In some implementations, processing the second image based on the first calculation result may include performing automatic white balance (AWB) processing or color correction matrix (CCM) processing on the second image, etc., without specific limitations.

[0043] Please see Figure 4 In some implementations, the first calculation result includes a first calculated value and a second calculated value, the second calculation result includes a third calculated value and a fourth calculated value, and step 03 (determining the cosine similarity between the first calculation result and the second calculation result) includes:

[0044] 032: Establish a coordinate system, with the first and second calculated values ​​as the coordinate points of the first calculation result, and the origin and the first calculation result forming the first vector; the third and fourth calculated values ​​as the coordinate points of the second calculation result, and the origin and the second calculation result forming the second vector.

[0045] 034: Calculate the cosine of the angle between the first vector and the second vector to obtain the cosine similarity.

[0046] Please see Figure 5 In some embodiments, the first calculation result includes a first calculated value and a second calculated value, the second calculation result includes a third calculated value and a fourth calculated value, and the third processing module 33 includes a first processing unit 332 and a second processing unit 334. Step 032 can be implemented by the first processing unit 332, and step 034 can be implemented by the second processing unit 334. That is, the first processing unit 332 can be used to establish a coordinate system, with the first and second calculated values ​​serving as the coordinate points of the first calculation result, and the origin of the coordinate system forming a first vector with the first calculation result; the third and fourth calculated values ​​serve as the coordinate points of the second calculation result, and the origin of the coordinate system forming a second vector with the second calculation result. The second processing unit 334 can be used to calculate the cosine value of the angle between the first vector and the second vector as the cosine similarity.

[0047] Thus, the similarity between two vectors can be measured by measuring their cosine similarity.

[0048] Specifically, the cosine similarity in this application is used to calculate the color component ratio; therefore, the cosine similarity value ranges from 0 to 1. The cosine value of a 0-degree angle is 1, while the cosine value of any other angle is no greater than 1. The cosine value of the angle between the first vector and the second vector can determine whether the two vectors point approximately in the same direction. When the two vectors point in the same direction, the cosine similarity value is 1; when the angle between the two vectors is 90°, the cosine similarity value is 0. This result is independent of the length of the vectors and only related to their pointing direction. Therefore, it can be determined whether the two vectors point approximately in the same direction based on whether the cosine similarity is greater than a preset similarity value. When the two vectors point approximately in the same direction, it indicates that the color temperatures of the first camera and the second camera are relatively consistent. Therefore, the second image can be processed based on the first calculation result of the first image to correct the color of the second image, thereby making the colors of the first camera 10 and the second camera 20 basically consistent, and preventing color jumps during camera switching.

[0049] In one embodiment, the first calculated value is x1, the second calculated value is y1, the first vector is a, the third calculated value is x2, the fourth calculated value is y2, and the second vector is b. Then the cosine similarity is:

[0050]

[0051] Please see Figure 6 In some embodiments, the first image includes a first color channel, a second color channel, and a third color channel. Step 01 (determining a first calculation result based on the color component ratios of the first image captured by the first camera 10) includes:

[0052] 012: Determine the first ratio based on the color components of the first color channel of the first image and the color components of the second color channel of the first image;

[0053] 014: Determine the second ratio based on the color components of the third color channel of the first image and the color components of the second color channel of the first image;

[0054] 016: Obtain the first calculated value and the second calculated value based on the first ratio, the second ratio, and the preset conversion relationship.

[0055] Please see Figure 7 In some embodiments, the first image includes a first color channel, a second color channel, and a third color channel. The first processing module 31 includes a first calculation unit 312, a second calculation unit 314, and a third calculation unit 316. Step 012 can be implemented by the first calculation unit 312, step 014 can be implemented by the second calculation unit 314, and step 016 can be implemented by the third calculation unit 316. That is, the first calculation unit 312 can be used to determine a first ratio based on the color components of the first color channel and the second color channel of the first image. The second calculation unit 314 can be used to determine a second ratio based on the color components of the third color channel and the second color channel of the first image. The third calculation unit 316 can be used to obtain a first calculated value and a second calculated value based on the first ratio, the second ratio, and a preset conversion relationship.

[0056] In this way, accurate initial calculation results can be obtained.

[0057] Specifically, the first color channel is, for example, the red channel, the second color channel is, for example, the green channel, and the third color channel is, for example, the blue channel. A first ratio R1 / G1 is determined based on the color component R1 of the red channel of the first image and the color component G1 of the green channel of the first image. A second ratio B1 / G1 is determined based on the color component B1 of the blue channel of the first image and the color component G1 of the green channel of the first image. The calculated first ratio R1 / G1 and second ratio B1 / G1 can be used to characterize the color distribution of the first image of the first camera 10. Since the response curves of each camera are different, the first ratio and the second ratio can be converted using a preset conversion relationship to infer the color distribution of the second image of the second camera 20, that is, to obtain the first calculation result R'1 / G'1 and the second calculation result B'1 / G'1. The preset conversion relationship can be determined experimentally and saved in advance.

[0058] Please see Figure 8In some embodiments, the second image includes a first color channel, a second color channel, and a third color channel. Step 02 (determining the second calculation result based on the color component ratios of the second image captured by the second camera 20) includes:

[0059] 022: Determine a third ratio based on the color components of the first color channel of the second image and the color components of the second color channel of the second image to serve as the third calculated value;

[0060] 024: Determine a fourth ratio based on the color components of the third color channel of the second image and the color components of the second color channel of the second image as the fourth calculated value.

[0061] Please see Figure 9 In some embodiments, the second image includes a first color channel, a second color channel, and a third color channel, and the second processing module 32 includes a fourth calculation unit 322 and a fifth calculation unit 324. Step 022 can be implemented by the fourth calculation unit 322, and step 024 can be implemented by the fifth calculation unit 324. That is, the fourth calculation unit 322 can be used to determine a third ratio based on the color components of the first color channel and the second color channel of the second image as a third calculated value. The fifth calculation unit 324 can be used to determine a fourth ratio based on the color components of the third color channel and the second color channel of the second image as a fourth calculated value.

[0062] In this way, an accurate second calculation result can be obtained.

[0063] Specifically, the first color channel is, for example, the red channel, the second color channel is, for example, the green channel, and the third color channel is, for example, the blue channel. A third ratio R2 / G2 is determined based on the color component R2 of the red channel of the second image and the color component G2 of the green channel of the second image. A fourth ratio B2 / G2 is determined based on the color component B2 of the blue channel of the second image and the color component G2 of the green channel of the second image. The calculated third ratio R2 / G2 and fourth ratio B2 / G2 can be used to characterize the color distribution of the second image of the second camera 20. Therefore, the third ratio can be used as the third calculated value, and the fourth ratio can be used as the fourth calculated value.

[0064] In some embodiments, the image processing method further includes: when the first camera 10 is operating, processing the first image according to the color component ratio of the first image to correct the color of the first image. The color component ratio of the first image can be a first ratio R1 / G1 and a second ratio B1 / G1. Processing the first image may include automatic white balance processing or color correction matrix processing, etc., and is not specifically limited here.

[0065] Please see Figure 10 In some embodiments, the image processing method further includes:

[0066] 05: During the process of switching from the operation of the first camera 10 to the operation of the second camera 20, control the first camera 10 and the second camera 20 to simultaneously open a preset number of frames to obtain the first image and the second image.

[0067] Please see Figure 11 In some embodiments, the image processing device 30 further includes a first control module 35. Step 05 can be implemented by the first control module 35, that is, the first control module 35 can be used to control the first camera 10 and the second camera 20 to simultaneously open a preset number of frames to obtain the first image and the second image during the process of switching the first camera 10 to the second camera 20.

[0068] In this way, the first camera 10 and the second camera 20 can be activated simultaneously for information exchange. After a preset number of frames, the first camera 10 can be turned off to reduce power consumption.

[0069] Specifically, if the first camera 10 and the second camera 20 remain constantly operational, the power consumption of the electronic device 100 increases by approximately 140mA compared to when only one camera is operational. However, by simultaneously enabling the first camera 10 and the second camera 20 at a preset frame rate and then turning off the first camera 10, power consumption can be significantly reduced. For example, if the preset frame rate is 5 frames, the power consumption increase can be reduced to only 2mA, which is more than 95% lower than when the camera is always on.

[0070] In some implementations, the preset frame rate can be adjusted according to scene information. For example, in mixed light source scenes or moving scenes, the scene is more complex. Therefore, the preset frame rate can be increased (e.g., from 5 frames to 8 frames) to increase the time when the first camera 10 and the second camera 20 work simultaneously. This facilitates the transition from the color temperature of the first camera 10 to the color temperature of the second camera, resulting in a smooth transition and avoiding a sudden color change for the user.

[0071] Please see Figure 12 In some embodiments, the image processing method further includes:

[0072] 06: After the first camera 10 is turned off and the second camera 20 is turned on, control the second camera 20 to capture the second image.

[0073] Please see Figure 13In some embodiments, the image processing device 30 further includes a second control module 36. Step 06 can be implemented by the second control module 36, that is, the second control module 36 can be used to control the second camera 20 to acquire a second image after the first camera 10 is turned off and the second camera 20 is turned on.

[0074] Thus, after switching to the second camera 20, the second camera 20 can still capture the second image and execute the image processing method of this application.

[0075] Specifically, after switching to the second camera 20, the current cosine similarity can be determined based on the first calculation result and the second calculation result corresponding to the color component ratio of the second image currently captured by the second camera 20. The processing method for the second image is then determined based on the current cosine similarity. When the current cosine similarity is greater than a preset similarity, the currently captured second image is processed according to the first calculation result. Here, the current cosine similarity is the cosine similarity between the first calculation result of the first camera 10 before switching and the second calculation result of the second camera 20 after switching. That is to say, after switching from the first camera 10 to the second camera 20, the second camera can still continue to use the first calculation result of the first camera 10 until the current cosine similarity is less than the preset similarity.

[0076] Please see Figure 14 In some embodiments, the image processing method includes:

[0077] 07: When the cosine similarity is less than the preset similarity, the second image is processed according to the second calculation result to correct the color of the second image.

[0078] Please see Figure 15 In some embodiments, the image processing apparatus 30 includes a fifth processing module 37. Step 07 can be implemented by the fifth processing module 37, that is, the fifth processing module 37 can be used to process the second image according to the second calculation result to correct the color of the second image when the cosine similarity is less than a preset similarity.

[0079] Thus, when the cosine similarity is less than the preset similarity, the second image can be processed based on the second calculation result of the second camera 20 itself.

[0080] Specifically, in scenarios where the cosine similarity is less than the preset similarity, processing the second image using the first calculation result can easily lead to color deviation in the second image. In such cases, processing the second image using the second calculation result will result in more accurate color reproduction. For example, with... Figure 16For example, the field of view of the first camera 10 is greater than that of the second camera 20. Under the field of view of the first camera 10, the indoor color temperature is lower (reddish) and the outdoor color temperature is higher (blued). The field of view of the second camera is outdoors. If the image processing is always based on the first calculation result corresponding to the first camera 10, it is easy to cause the color of the second image to be deviated. Therefore, when the cosine similarity is less than the preset similarity, it can be transitioned to processing the second image based on the second calculation result of the second camera 20 itself.

[0081] by Figure 17 The image processing method of this application is explained using three cameras as an example. Awb_Mgr_Wide represents the thread where the wide-angle camera is located, Awb_Mgr_Main represents the thread where the main camera is located, Awb_Mgr_Tele represents the thread where the telephoto camera is located, and Sync3A is a module used to manage the information transmission between multi-threaded modules. In one embodiment, three camera instances can be created first. Then, Sync3A can send a signal to designate the main camera as the first camera 10. During the switching process from the main camera to the wide-angle camera, the wide-angle camera is designated as the second camera 20. The wide-angle camera can determine the calculation result based on its own captured image (which is then used as the second calculation result). Sync3A can then transmit the calculation result determined by the main camera (which is then used as the first calculation result) to the wide-angle camera. The wide-angle camera can determine the cosine similarity between the two calculation results. When the cosine similarity is greater than a preset similarity, the wide-angle camera uses the calculation result determined by the main camera for image processing. When the cosine similarity is less than the preset similarity, the wide-angle camera uses its own calculation result for image processing. After the camera switching is complete, the main camera can be turned off, and thereafter the wide-angle camera becomes the first camera 10.

[0082] During the process of switching the wide-angle camera to the main camera, the main camera is used as the second camera 20. The main camera can determine the calculation result based on the image it captures (at this time, it is used as the second calculation result), and Sync3A can transmit the calculation result determined by the wide-angle camera (at this time, it is used as the first calculation result) to the main camera. The main camera can determine the cosine similarity between the two calculation results. When the cosine similarity is greater than the preset similarity, the main camera uses the calculation result determined by the wide-angle camera for image processing. When the cosine similarity is less than the preset similarity, the main camera uses its own calculation result for image processing. After the camera switching is completed, the wide-angle camera can be turned off, and then the main camera becomes the first camera 10.

[0083] It should be noted that the specific values ​​mentioned above are only for illustrating the implementation of this application in detail, and should not be construed as limitations on this application. In other examples, implementation methods, or embodiments, other values ​​may be selected according to this application, and no specific limitations are made here.

[0084] Please see Figure 2 The image processing method of this application embodiment can be implemented by the electronic device 100 of this application embodiment. Specifically, the electronic device 100 includes one or more processors 50 and a memory 40. The memory 40 stores a computer program. When the computer program is executed by the processor 50, the steps of the image processing method of any of the above embodiments are implemented.

[0085] For example, when a computer program is executed by processor 50, the following steps are implemented for image processing:

[0086] 01: Determine the first calculation result based on the color component ratio of the first image captured by the first camera 10;

[0087] 02: Determine the second calculation result based on the color component ratio of the second image captured by the second camera 20;

[0088] 03: Determine the cosine similarity between the first and second calculation results;

[0089] 04: When the cosine similarity is greater than the preset similarity, the second image is processed according to the first calculation result to correct the color of the second image.

[0090] The computer-readable storage medium of the present application embodiment stores a computer program thereon, which, when executed by a processor, implements the steps of the image processing method of any of the above embodiments.

[0091] For example, when the program is executed by a processor, the following steps are implemented for image processing:

[0092] 01: Determine the first calculation result based on the color component ratio of the first image captured by the first camera 10;

[0093] 02: Determine the second calculation result based on the color component ratio of the second image captured by the second camera 20;

[0094] 03: Determine the cosine similarity between the first and second calculation results;

[0095] 04: When the cosine similarity is greater than the preset similarity, the second image is processed according to the first calculation result to correct the color of the second image.

[0096] It is understood that a computer program includes computer program code. Computer program code can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable storage media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, external hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution media, etc. The processor can be a central processing unit (CPU), or 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, etc.

[0097] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0098] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the function involved, as will be understood by those skilled in the art to which embodiments of this application pertain.

[0099] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. An image processing method, characterized in that, The image processing method includes: Determining a first calculation result based on the color component ratio of a first image captured by a first camera includes determining a first ratio based on the color components of a first color channel and a second color channel of the first image; determining a second ratio based on the color components of a third color channel and a second color channel of the first image; and obtaining a first calculated value and a second calculated value based on the first ratio, the second ratio, and a preset conversion relationship. Determining a second calculation result based on the color component ratio of the second image captured by the second camera includes: determining a third ratio based on the color component of the first color channel of the second image and the color component of the second color channel of the second image as a third calculation value; and determining a fourth ratio based on the color component of the third color channel of the second image and the color component of the second color channel of the second image as a fourth calculation value. Determine the cosine similarity between the first calculation result and the second calculation result; the first calculation result includes a first calculated value and a second calculated value, and the second calculation result includes a third calculated value and a fourth calculated value; When the cosine similarity is greater than a preset similarity, the second image is processed according to the first calculation result to correct the color of the second image.

2. The image processing method according to claim 1, characterized in that, Determining the cosine similarity between the first calculation result and the second calculation result includes: Establish a coordinate system, where the first calculated value and the second calculated value serve as the coordinate points of the first calculation result, and the origin of the coordinate system and the first calculation result form a first vector; the third calculated value and the fourth calculated value serve as the coordinate points of the second calculation result, and the origin of the coordinate system and the second calculation result form a second vector. The cosine of the angle between the first vector and the second vector is calculated as the cosine similarity.

3. The image processing method according to claim 1, characterized in that, The image processing method further includes: During the process of switching from the operation of the first camera to the operation of the second camera, the first camera and the second camera are controlled to simultaneously open for a preset number of frames to obtain the first image and the second image.

4. The image processing method according to claim 3, characterized in that, The image processing method further includes: After the first camera is turned off and the second camera is turned on, control the second camera to capture the second image.

5. The image processing method according to claim 1, characterized in that, The image processing method includes: When the cosine similarity is less than a preset similarity, the second image is processed according to the second calculation result to correct the color of the second image.

6. An image processing apparatus, characterized in that, The image processing device includes: A first processing module is configured to determine a first calculation result based on the color component ratio of a first image captured by a first camera. The first processing module includes a first calculation unit, a second calculation unit, and a third calculation unit. The first calculation unit is configured to determine a first ratio based on the color components of a first color channel and a second color channel of the first image. The second calculation unit is configured to determine a second ratio based on the color components of a third color channel and a second color channel of the first image. The third calculation unit is configured to obtain a first calculated value and a second calculated value based on the first ratio, the second ratio, and a preset conversion relationship. The second processing module is used to determine a second calculation result based on the color component ratio of the second image captured by the second camera. The second processing module includes a fourth calculation unit and a fifth calculation unit. The fourth calculation unit is used to determine a third ratio based on the color components of the first color channel of the second image and the color components of the second color channel of the second image as a third calculation value. The fifth calculation unit is used to determine a fourth ratio based on the color components of the third color channel of the second image and the color components of the second color channel of the second image as a fourth calculation value. A third processing module is used to determine the cosine similarity between the first calculation result and the second calculation result; the first calculation result includes a first calculated value and a second calculated value, and the second calculation result includes a third calculated value and a fourth calculated value; The fourth processing module is used to process the second image according to the first calculation result to correct the color of the second image when the cosine similarity is greater than the preset similarity.

7. The image processing apparatus according to claim 6, characterized in that, The third processing module includes a first processing unit and a second processing unit. The first processing unit is used to establish a coordinate system, where the first calculated value and the second calculated value serve as the coordinate points of the first calculation result, and the origin of the coordinate system and the first calculation result form a first vector. The third calculated value and the fourth calculated value serve as the coordinate points of the second calculation result, and the origin of the coordinate system and the second calculation result form a second vector. The second processing unit is used to calculate the cosine value of the angle between the first vector and the second vector as the cosine similarity.

8. The image processing apparatus according to claim 6, characterized in that, The image processing device further includes a first control module, which is used to control the first camera and the second camera to simultaneously open a preset number of frames to obtain the first image and the second image during the process of switching the operation of the first camera to the operation of the second camera.

9. The image processing apparatus according to claim 6, characterized in that, The image processing device further includes a second control module, which is used to control the second camera to acquire the second image after the first camera is turned off and the second camera is turned on.

10. The image processing apparatus according to claim 6, characterized in that, The image processing device further includes a fifth processing module, which is used to process the second image according to the second calculation result to correct the color of the second image when the cosine similarity is less than a preset similarity.

11. An electronic device, characterized in that, The electronic device includes one or more processors and a memory, the memory storing a computer program that, when executed by the processor, implements the steps of the image processing method according to any one of claims 1-5.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the steps of the image processing method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Image color consistency processing method and image acquisition equipment

    CN106296696A

  • Main body detection method and device, electronic equipment and computer readable storage medium

    CN110688926A