CN-116704049-B - Image processing method, image processing apparatus, electronic device, and storage medium
Abstract
The application discloses an image processing method, an image processing device, electronic equipment and a computer readable storage medium. The image processing method comprises the steps of determining a first calculation result according to a color component ratio of a first image acquired by a first camera, determining a second calculation result according to a color component ratio of a second image acquired by a second camera, determining cosine similarity of the first calculation result and the second calculation result, and processing the second image according to the first calculation result to correct the color of the second image when the cosine similarity is larger than a preset similarity. In the image processing method, the device, the electronic equipment and the storage medium, when the cosine similarity of the first calculation result and the second calculation result is larger than the preset similarity, the color temperatures of the first image and the second image are relatively close, so that the second image can be processed according to the first calculation result of the first image to correct the color of the second image, and the colors of the first camera and the second camera are basically consistent.
Inventors
- WANG LIN
Assignees
- OPPO广东移动通信有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20220222
Claims (12)
- 1. An image processing method, characterized in that the image processing method comprises: Determining a first calculation result according to a color component ratio of a first image acquired by a first camera, wherein the first calculation result comprises a first ratio determined according to a color component of a first color channel of the first image and a color component of a second color channel of the first image; Determining a second calculation result according to the color component ratio of a second image acquired by a second camera, wherein the second calculation result comprises determining a third ratio according to the color components of a first color channel of the second image and the color components of a second color channel of the second image to be used as a third calculation value; The cosine similarity of the first calculation result and the second calculation result is determined, wherein the first calculation result comprises a first calculation value and a second calculation value, and the second calculation result comprises a third calculation value and a fourth calculation value; and when the cosine similarity is larger than the preset similarity, processing the second image according to the first calculation result to correct the color of the second image.
- 2. The image processing method according to claim 1, wherein the determining the cosine similarity of the first calculation result and the second calculation result includes: Establishing a coordinate system, wherein the first calculated value and the second calculated value are used as coordinate points of the first calculated result, and a coordinate origin and the first calculated result form a first vector; And calculating the cosine value of the included angle between the first vector and the second vector to serve as the cosine similarity.
- 3. The image processing method according to claim 1, characterized in that the image processing method further comprises: and in the process of switching the first camera work to the second camera work, controlling the first camera and the second camera to be simultaneously started for a preset frame number so as 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 comprises: And after the first camera is closed and the second camera works, controlling the second camera to acquire the second image.
- 5. The image processing method according to claim 1, characterized in that the image processing method comprises: and when the cosine similarity is smaller than a preset similarity, processing the second image 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 apparatus comprises: The first processing module is used for determining a first calculation result according to the color component ratio of the first image acquired by the first camera; the first processing module comprises a first computing unit, a second computing unit and a third computing unit; the first computing unit is used for determining a first ratio according to the color components of a first color channel of the first image and the color components of a second color channel of the first image, the second computing unit is used for determining a second ratio according to the color components of a third color channel of the first image and the color components of a second color channel of the first image, and the third computing unit is used for obtaining a first computing value and a second computing value according to the first ratio, the second ratio and a preset conversion relation; The second processing module is used for determining a second calculation result according to the color component ratio of the second image acquired by the second camera; the second processing module comprises a fourth computing unit and a fifth computing unit, wherein the fourth computing unit is used for determining a third ratio as a third computing value according to 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; The third processing module is used for determining cosine similarity of the first calculation result and the second calculation result, wherein the first calculation result comprises a first calculation value and a second calculation value, and the second calculation result comprises a third calculation value and a fourth calculation value; and the fourth processing module is used for processing the second image according to the first calculation result to correct the color of the second image when the cosine similarity is larger than a preset similarity.
- 7. The image processing apparatus according to claim 6, wherein the third processing module includes a first processing unit configured to establish a coordinate system, the first calculation value and the second calculation value as coordinate points of the first calculation result, a coordinate origin and the first calculation result forming a first vector, the third calculation value and the fourth calculation value as coordinate points of the second calculation result, the coordinate origin and the second calculation result forming a second vector, and the second processing unit configured to calculate cosine values of angles of the first vector and the second vector as the cosine similarity.
- 8. The image processing device according to claim 6, further comprising a first control module, wherein the first control module is configured to control the first camera and the second camera to be simultaneously turned on for a preset number of frames to obtain the first image and the second image during switching from the first camera operation to the second camera operation.
- 9. The image processing device of claim 6, further comprising a second control module configured to control the second camera to capture the second image after the first camera is closed and the second camera is operational.
- 10. The image processing apparatus according to claim 6, further comprising a fifth processing module configured to process the second image according to the second calculation result to correct a color of the second image when the cosine similarity is smaller than a preset similarity.
- 11. An electronic device comprising one or more processors and a memory storing a computer program which, when executed by the processor, implements the steps of the image processing method of any of claims 1-5.
- 12. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the steps of the image processing method of any one of claims 1-5.
Description
Image processing method, image processing apparatus, electronic device, and storage medium Technical Field The present application relates to an image processing technology, and more particularly, to an image processing method, an image processing apparatus, an electronic device, and a computer-readable storage medium. Background In the related art, an electronic device may include a plurality of cameras, such as a main camera, a wide angle camera, a tele camera, and the like. The phenomenon of color jump can occur in the zooming process of the cameras, so that the color acquired by the cameras is difficult to achieve consistency. Disclosure of Invention Embodiments of the present application provide an image processing method, an image processing apparatus, an electronic device, and a computer-readable storage medium. The image processing method comprises the steps of determining a first calculation result according to a color component ratio of a first image acquired by a first camera, determining a second calculation result according to a color component ratio of a second image acquired by a second camera, determining cosine similarity of the first calculation result and the second calculation result, and processing the second image according to the first calculation result to correct the color of the second image when the cosine similarity is larger than a preset similarity. The image processing device of the embodiment of the application comprises a first processing module, a second processing module, a third processing module and a fourth processing module. The first processing module is used for determining a first calculation result according to the color component ratio of the first image acquired by the first camera. The second processing module is used for determining a second calculation result according to the color component ratio of the second image acquired by the second camera. The third processing module is used for determining cosine similarity of the first calculation result and the second calculation result. And the fourth processing module is used for processing the second image according to the first calculation result to correct the color of the second image when the cosine similarity is larger than a preset similarity. An electronic device of an embodiment of the application includes one or more processors and memory. The memory stores a computer program. The steps of the image processing method described in the above embodiment are implemented when the computer program is executed by the processor. The computer-readable storage medium according to an embodiment of the present application has a computer program stored thereon, and is characterized in that the steps of the image processing method according to the above embodiment are realized when the program is executed by a processor. In the image processing method, the image processing device, the electronic equipment and the computer readable storage medium, when the cosine similarity of the first calculation result and the second calculation result is larger than the preset similarity, the color temperatures of the first image and the second image are relatively close, so that the second image can be processed according to the first calculation result of the first image to correct the color of the second image, the colors of the first camera and the second camera are basically consistent, and the phenomenon of color jump can not occur in the camera switching process. Additional aspects and advantages of the 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 the application. Drawings The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which: FIG. 1 is a flow chart of an image processing method according to some embodiments of the present application; FIG. 2 is a schematic diagram of an electronic device in accordance with certain embodiments of the application; FIG. 3 is a schematic diagram of an image processing apparatus according to some embodiments of the present application; FIG. 4 is a flow chart of an image processing method according to some embodiments of the present application; FIG. 5 is a schematic diagram of a third process module according to some embodiments of the application; FIG. 6 is a flow chart of an image processing method according to some embodiments of the present application; FIG. 7 is a schematic diagram of a first process module according to some embodiments of the application; FIG. 8 is a flow chart of an image processing method according to some embodiments of the present application; FIG. 9 is a schematic diagram of a second process module according to some embodiments of the application; FIG. 10 is a flow chart of an