WO2023122860A1 - Image processing method and apparatus, image acquisition device, and storage medium - Google Patents

Image processing method and apparatus, image acquisition device, and storage medium Download PDF

Info

Publication number
WO2023122860A1
WO2023122860A1 PCT/CN2021/141521 CN2021141521W WO2023122860A1 WO 2023122860 A1 WO2023122860 A1 WO 2023122860A1 CN 2021141521 W CN2021141521 W CN 2021141521W WO 2023122860 A1 WO2023122860 A1 WO 2023122860A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
pixel block
scene
target
processed
Prior art date
Application number
PCT/CN2021/141521
Other languages
French (fr)
Chinese (zh)
Inventor
王雯琪
严毅民
郑子翔
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2021/141521 priority Critical patent/WO2023122860A1/en
Publication of WO2023122860A1 publication Critical patent/WO2023122860A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/73Colour balance circuits, e.g. white balance circuits or colour temperature control

Definitions

  • the present application relates to the technical field of image processing, and in particular, to an image processing method, device, image acquisition device, and storage medium.
  • a white balance gain may be determined based on RGB values of white points in the image, and then white balance processing is performed on the image by using the white balance gain. Therefore, accurately determining the white balance gain is the key to improving the effect of image white balance processing.
  • the white point and the white balance gain are usually determined only according to the RGB values of the pixels in the image, and the white balance gain obtained in this way is not accurate enough, resulting in poor image white balance processing effect.
  • the present application provides an image processing method, device, image acquisition device and storage medium.
  • an image processing method comprising:
  • an image processing device the device includes a processor, a memory, and a computer program stored in the memory that can be executed by the processor, and the processor executes the computer program
  • the following steps can be implemented:
  • an image acquisition device includes the image processing apparatus mentioned in the second aspect above.
  • a computer-readable storage medium is provided, and a computer program is stored on the computer-readable storage medium, and when the computer program is executed, the method mentioned in the above-mentioned first aspect is implemented.
  • Fig. 1 is a flowchart of an image processing method according to an embodiment of the present application.
  • Fig. 2 is a schematic diagram of an image processing method according to an embodiment of the present application.
  • Fig. 3 is a schematic diagram of a logical structure of an image processing device according to an embodiment of the present application.
  • a white balance gain may be determined based on RGB values of white points in the image, and then white balance processing is performed on the image by using the white balance gain.
  • Accurate determination of white balance gain is the key to improve the effect of image white balance processing.
  • the white point in the image is usually determined only according to the RGB values of the image, and then the white balance gain is determined. The white balance gain obtained in this way is often not accurate enough.
  • the principle of white balance correction is to find the white objects in the image, and then restore the color of these objects to white.
  • pixel blocks with similar RGB values they may be different scenes.
  • the RGB values of white objects and yellow objects under yellow light sources are very different. Similar, but one of the two is white and the other is non-white, so it is easy to misjudge when determining the white point.
  • the probability of this pixel block being a white object is It is different, or in a rainy day scene or a cloudy day scene, the probability of being a white object is also different.
  • the white balance gain is determined only according to the RGB value of the image block, some pixels that are not white objects may be mistakenly determined as white points, or the pixels corresponding to white objects may be misjudged as non-white points, resulting in a certain white
  • the balance gain is not accurate enough, and the image effect after white balance processing is not ideal.
  • the embodiment of the present application provides an image processing method.
  • determining the white balance gain used for white balance correction on the image considering that the white balance gain determined only based on the RGB values of the image is not accurate enough, it can first Determine the scene category information of each pixel block in the image to be processed, and then combine the scene category information of each pixel block to assist in determining the white balance gain, so that a more accurate white balance gain can be obtained, and a more ideal white balance processing effect can be obtained.
  • the image processing method in the embodiment of the present application can be executed by the image acquisition device, for example, it can be executed by the ISP chip in the image acquisition device, or the image can be collected by the image acquisition device and sent to other devices. Process software execution.
  • the flow chart of the image processing method provided by the embodiment of the present application may specifically include the following steps:
  • images to be processed may be acquired, where the images to be processed may be various images that require white balance correction processing.
  • the scene category information of the pixel block in the image to be processed can be determined, wherein the scene category information can be various information indicating the scene category to which the pixel block belongs, and the scene category can classify the scene in various ways get.
  • the scene category information may be information indicating which object category the pixel block specifically belongs to, for example, it may be information indicating that the pixel block is of various categories such as green plants, sky, and ground.
  • the scene category information may also be information indicating the scene category to which the entire image to be processed belongs, for example, indicating whether the image to be processed is an indoor scene or an outdoor scene, whether it is a sunny scene or a rainy scene, and the like. It is not difficult to understand that any scene category information that helps to assist in determining the white balance gain of an image falls within the scope of protection of the embodiments of the present application.
  • a pre-trained neural network can be used to perform semantic segmentation on the image, or other ways can be used, which are not limited in the embodiment of the present application.
  • the scene category information of the pixel block may be used to assist in determining the target white balance gain. For example, it can be combined with the scene category information of the pixel block to determine whether the pixel point of the pixel block is a white point, and then determine the target white balance gain based on the determined white point, or, after determining the white point in the image, further combine the pixel Determine the weight corresponding to each white point based on the scene category information of the block, and determine the target white balance gain by combining the weight corresponding to the white point and the RGB value, or adjust the white balance gain based on the scene category information of the pixel block after determining the white balance gain , to obtain the final target white balance gain, and then use the determined target white balance gain to perform white balance correction on the image to be processed.
  • the white balance gain can be determined based on the scene category information, so that the determined white balance gain is more accurate, and a better white balance processing effect can be achieved.
  • the scene category information may include the category of the target object to which the pixel block belongs, for example, the specific category of the pixel block is sky, grass, road, vehicle, person, etc., combined with the target object category to which the pixel block belongs, can be It assists in determining whether the pixel block is a white point, or the probability of the pixel block being a white point, and then can accurately determine the white balance gain.
  • the scene category information may be information indicating that the image to be processed is an indoor scene or an outdoor scene.
  • the white balance gain when the image to be processed is an indoor scene or an outdoor scene, it will also have a certain impact on the determination of the white balance gain. For example, if it is the same white point, its brightness will be larger in the outdoor scene , in the indoor scene, its brightness is darker, so for the same RGB pixel, the probability of being a white point is different in the outdoor scene and the indoor scene. Therefore, the white point in the pixel block can be accurately determined based on the information indicating that the image to be processed is an indoor scene or an outdoor scene, or the information can be used to adjust the white balance gain to obtain an accurate white balance gain.
  • multiple object categories can be preset, and then the pixel block is determined to be a specific category in the preset multiple object categories.
  • the multiple object categories can be the following categories: sky, building, Green plants, soil, roads, floors, others. When setting these multiple object categories, you can set them based on the following principles:
  • the preset object category can be used to determine whether the image to be processed is an indoor scene or an outdoor scene.
  • the preset object category can be the sky (can be determined to be an outdoor scene), the floor (can be determined to be an indoor scene), or other Other categories that can be used to determine indoor or outdoor scenes. Since indoor and outdoor scenes have an impact on the determination of the white balance gain, determining the target white balance gain can be assisted based on whether the pixel blocks belong to these categories.
  • the pre-set object category can be used to determine the white point in the image to be processed. For example, accurately determining the white point is a prerequisite for accurately determining the white balance gain. If the white point can be accurately determined in combination with the target object category to which the pixel block belongs, it is bound to Will improve the accuracy of the determined white balance gain. Therefore, the preset object category is a category that can assist in determining whether a pixel is a white point, for example, the sun, if the pixel block is determined to be the sun, then the pixel in the pixel block is a white point.
  • the pixel block when determining the target object category to which the pixel block belongs, can be respectively determined as the target confidence level of each object category in the preset plurality of object categories, and then based on the target confidence level, the A target object category to which the pixel block belongs is determined among the plurality of object categories.
  • the preset multiple object categories are sky, building, green plant, soil, road, floor, and others, so it is possible to determine the target confidence of each pixel block for each of the above categories, and then determine the pixel block based on the target confidence The target object class to which it belongs.
  • the object category with the highest target confidence may be directly used as the target object category to which the pixel block belongs.
  • the target object category to which the pixel block belongs may also be determined based on the target confidence of each pixel block for each of the above categories and the target object categories to which the adjacent pixel blocks of the pixel block belong. For example, if the confidence that the pixel block belongs to the sky is 80%, and the confidence that it belongs to the road is 85%, and its adjacent pixel blocks are all sky, then the pixel block is considered to belong to the sky.
  • the initial confidence that the pixel block is the object category can be determined respectively, for example, Determine the initial confidence that the pixel block is the object category based on the pre-trained neural network, or determine the initial confidence in other ways, and then directly use the initial confidence as the target confidence.
  • the initial confidence determined based on the neural network or other methods may not be accurate. Therefore, after the initial confidence is determined, the initial confidence can be further adjusted based on the information related to the pixel value of the pixel block itself, In order to get a more accurate target confidence.
  • the pixel value-related information may include one or more of the following: the brightness of the pixel block, the first proportion of the first specified pixel area in the pixel block, wherein the RGB value of the first specified pixel area fall within the color range corresponding to the scene category.
  • the brightness of the object category can be pre-calibrated.
  • the brightness of the sky is A.
  • the confidence that the pixel block is the sky is greater, so it can be based on The degree of proximity adjusts the initial confidence to obtain a more accurate target confidence.
  • the color interval corresponding to each object category can be determined, for example, the color interval of each object category can be pre-marked, or can also be obtained based on other methods. Assuming that the color interval of the sky is determined to be B, then, based on the first ratio of the first specified pixel area in the pixel block that falls into the color interval in the entire pixel block, the larger the first ratio, it means that the pixel block is The greater the confidence of the sky, the initial confidence can be adjusted based on the size of the first proportion to obtain a more accurate target confidence.
  • the target confidence is directly related to how close the brightness of the pixel block is to the nominal brightness of the object class.
  • the luminance of the pixel block is closer to the calibrated luminance, it means that the confidence of the pixel block is the object category is greater.
  • the target confidence is positively related to the first proportion, and the larger the first proportion, the greater the confidence that the pixel block belongs to the object category.
  • the initial confidence determined based on the neural network is inaccurate, so the target confidence can be adjusted is 0.
  • the information indicating that the image to be processed is an indoor scene or an outdoor scene may be one or more of a confidence level that the image to be processed is an indoor scene, and a confidence level that the image to be processed is an outdoor scene.
  • the confidence degree of the image to be processed is an indoor scene or the confidence degree of an outdoor scene can be determined in the following manner: First, the object belonging to each target object category can be determined based on the target object category to which each pixel block in the image to be processed belongs. The second ratio of all pixel blocks in the image to be processed is determined based on the second ratio and the weight of each target object category for the indoor scene to determine the confidence that the image to be processed is an indoor scene. Similarly, the confidence that the image to be processed is an outdoor scene may be determined based on the second proportion and the weights of each target object category for the outdoor scene.
  • the image to be processed includes 100 pixel blocks of the same size, among which, 50 pixel blocks belong to the target object category of the sky, 30 pixel blocks belong to the target object category of green plants, and 10 pixel blocks belong to
  • the target object category of is road, and the target object category to which the 10 pixel blocks belong is other. Therefore, it can be determined that the second proportion of the sky area in the image to be processed is 50%, the second proportion of the green plant area is 30%, the second proportion of the road area is 10%, and the second proportion of other types of areas 10%.
  • the weight of each scene relative to the indoor scene and the outdoor scene can be determined. Assume that the weight of the sky is 20% for the indoor scene, 80% for the outdoor scene, 40% for the indoor scene, and 40% for the outdoor scene. 60%, etc., and then based on the second ratio and weight, the confidence level that the image to be processed is an indoor scene, for example, 0.2, and the confidence level for an outdoor scene, such as 0.8, can be determined.
  • the weight of each target object category for the indoor scene or the weight of each target object category for the indoor scene can be preset, or, in some embodiments, in order to obtain a more accurate weight, it can also be based on all objects belonging to each target object category. One or more of the brightness of the pixel block and the type of each target object category are determined.
  • the second proportion may be determined in combination with multiple frames of images collected before and after the image to be processed. For example, multiple frames of target images collected before and/or after the image to be processed can be obtained, the proportion of all pixel blocks belonging to each target object category in the multiple frames of target images, and the proportion of all pixel blocks belonging to each target object category in the image to be processed The proportion of the pixel block is filtered to obtain the second proportion.
  • the target weight of the white point in the pixel block when determining the target white balance gain based on the scene category information of the pixel block, can be determined first based on the target object category to which the pixel block belongs, and then based on each white point in the image to be processed
  • the RGB values of the points and the respective target weights determine the target white balance gain. For example, based on the RGB values of the pixels in the image to be processed, the white point in the image can be initially determined, and then the weight corresponding to the white point can be further combined with the scene category information of each pixel block.
  • the white balance gain based on the RGB of the white point
  • weighted average processing may be performed on the white balance gains determined by each white point in combination with the weight, so as to obtain the final target white balance gain.
  • the scene category information includes the target object category to which the pixel block belongs.
  • the target weights corresponding to the white points in the pixel block are also different.
  • the scene category information may also include information indicating that the image to be processed is an indoor scene or an outdoor scene.
  • the white point of each pixel block in the image to be processed The target weights are also different.
  • the initial weight of the white point in the pixel block can be determined first, and then based on the scene category information of the pixel block, such as , the target object category to which the pixel block belongs, whether the image to be processed is an indoor scene or an outdoor scene etc. adjust the initial weights to obtain the target weight of the white point in the pixel block.
  • the initial weight of the white point in the pixel block may be determined based on one or more of the brightness of the pixel block and the color temperature corresponding to the pixel block, wherein, The corresponding relationship between the RGB value and the color temperature can be calibrated in advance, and then the color temperature corresponding to the pixel block can be determined according to the RGB value of the pixel block.
  • the scene category information may include the confidence level that the image to be processed is an indoor scene, and/or the confidence level that the image to be processed is an outdoor scene. process to obtain the final target white balance gain.
  • the first target weight of the white point in the pixel block can be determined, and then the first white balance gain is determined according to the RGB value of the white point in the entire image to be processed and the first target weight, and at the same time
  • the second target weight of the white point in the pixel block can be determined, and then the second white balance gain can be determined according to the RGB value of the white point in the entire image to be processed and the second target weight. Then, based on the confidence that the image to be processed is an indoor scene and the confidence that the image to be processed is an outdoor scene, the first white balance gain and the second white balance gain may be weighted to obtain a target white balance gain.
  • the white balance gains in the two scenes are obtained by two-way processing, and then a comprehensive white balance gain can be obtained based on the confidence that the image to be processed belongs to the above two scenes, so that the final determination The white balance gain is more accurate.
  • the determined white balance gain can be further compensated based on the scene category information of the pixel block, so as to eliminate the influence of the white balance gain on the white balance gain caused by the scene confusion caused by the close color range .
  • the initial white balance gain of the image to be processed can be determined first, and then for each pixel block, it is determined whether the RGB value of the pixel block falls into the color of the confused color Interval, where the color interval of the confusing color can be set in advance, for example, common confusing scenes, and the color interval of these scenes can be predetermined, if the RGB value of the pixel block falls into these color intervals, it means that the pixel block belongs to There is a possibility of confusion in the category of the scene.
  • the initial white balance gain of the pixel block can be compensated based on the scene category information of the pixel block to obtain the target white balance gain of the pixel block, and then the white balance correction process of the pixel block can be performed using the target white balance gain.
  • the initial white balance gain is compensated based on the scene category information of the pixel blocks.
  • the compensation coefficient can be determined based on the scene category information of each pixel block, and then the compensation coefficient can be used to correct the initial white balance gain.
  • the gain is compensated to obtain the target white balance gain corresponding to the pixel block. For example, suppose the RGB value of a certain pixel block falls within the color interval of a white object under a fluorescent lamp. Since the object in this color interval may be a white object or a green plant, it can be combined with the The target scene category determines whether the pixel block is a green plant, and then adjusts the initial white balance gain based on whether it is a green plant to obtain the target white balance gain.
  • the compensation coefficient can be set based on the actual situation, so that the final target white balance gain is more accurate, and the image after white balance correction is closer to the real color.
  • the compensation coefficient can be determined based on the following method: the third proportion of the second designated area falling into the color interval of the confused color in the pixel block can be determined first, for example, it can be based on the RGB values of each area in the pixel block Determine whether the area falls into the color interval of the confused color, and then calculate the third proportion of all pixel areas falling into the color interval of the confused color in the entire pixel block. Then one of the third ratio, the category of the target object to which the pixel block belongs, the brightness of the pixel block, the color temperature corresponding to the previous frame image of the image to be processed, and the hue corresponding to the previous frame image of the image to be processed or more to determine the compensation coefficient.
  • the initial white balance gain in the image to be processed when determining the initial white balance gain in the image to be processed, it can be determined in a traditional way, for example, it can be determined directly based on the RGB value of the image.
  • the initial white balance gain for determination can be more Accurately, it is also possible to determine the target weight of the white point in the pixel block in combination with the scene category of each pixel block in the image to be processed, and then determine the initial white balance gain of the image to be processed based on the RGB value of the white point and the target weight, wherein, determine the pixel For the target weight of the white point in the block, and the specific implementation process of determining the initial white balance gain of the image to be processed based on the RGB value of the white point and the target weight, reference may be made to the description in the foregoing embodiments, and details are not repeated here.
  • the image to be processed when the image to be processed is compensated according to whether the pixel block falls into the mixed color range, it can also be processed in two ways for the outdoor scene and the indoor scene.
  • the scene category information may include the confidence that the image to be processed is an indoor scene, and the confidence that the image to be processed is an outdoor scene, and the compensation coefficient includes the first compensation coefficient when the image to be processed is an indoor scene, and the image to be processed is an outdoor scene. The second compensation coefficient in the scene.
  • the first compensation coefficient can be used to compensate the initial white balance gain
  • the obtained third white balance gain can be compensated by the second compensation coefficient to obtain the fourth white balance gain, which can then be based on the image to be processed as The confidence of the indoor scene and the confidence that the image to be processed is an outdoor scene are weighted and averaged on the third white balance gain and the fourth white balance gain to obtain the target white balance gain.
  • the compensation coefficient used to compensate the initial white balance can be different for outdoor scenes and indoor scenes, so that it is more in line with the characteristics of indoor scenes or outdoor scenes, so it can be used for indoor scenes.
  • Different compensation coefficients are determined for the scene and the outdoor scene, and then the white balance gains for the indoor scene and the outdoor scene are obtained, so that the final target can be obtained based on the confidence of the image to be processed as the indoor scene and the confidence of the outdoor scene.
  • White balance gain is
  • the white balance processing can eliminate the influence of the light source, the actual scene seen by the user will still be affected by the light source. For example, under a yellow light source, the overall object will be yellowish.
  • the image to be processed can be further processed with ambient color, so that the overall tone of the image is closer to the actual color.
  • this embodiment provides an image processing method, which specifically includes the following steps:
  • multiple scene categories for example, category A, category B, category C, etc.
  • the principles for setting the multiple category categories are as follows:
  • the image to be processed is an indoor scene or an outdoor scene, for example, it can be the sky (it can be determined to be an outdoor scene), and the floor (it can be determined to be an indoor scene).
  • (2) can be used to determine the white point in the image to be processed.
  • the color range of the scene included in the scene category overlaps with the color range of at least one scene other than this scene, for example, yellow objects and white objects under yellow light sources, green plants and white objects under fluorescent light wait
  • the initial confidence that each pixel block in the image belongs to each scene category among the plurality of scene categories can be determined through a pre-trained neural network. Since the initial confidence determined directly through the neural network is not accurate enough, the initial confidence can be adjusted by combining the brightness information of the pixel block and the proportion Q1 of the area in the pixel block falling into the color range corresponding to each scene category, and obtaining each The object confidence that the pixel block belongs to each scene category. Wherein, the closer the luminance information in the pixel block is to the pre-marked luminance of the scene category, the greater the target confidence. The larger the ratio Q1 is, the greater the possibility is that the pixel block belongs to the scene category, and the greater the target confidence is.
  • the scene category with the highest target confidence can be used as the scene category corresponding to the pixel block, and then the ratio of the area of all pixel blocks belonging to each scene category to the area of the image to be processed can be calculated, and each The proportion Q2 of a scene category in the image to be processed, wherein, since the proportion Q2 determined by a single frame image may not be accurate, it can be combined with the proportion Q2 of the multi-frame images before and after the image to be processed, and the proportion Q2 can be calculated. Filtering processing (for example, averaging or weighted averaging) to obtain the final proportion Q3.
  • the proportion Q3 of each scene category in the image to be processed, and the weight of the scene category corresponding to the indoor scene the confidence that the image to be processed is an indoor scene is obtained.
  • the proportion Q3 of each scene category in the image to be processed, and the weight of the scene category corresponding to the outdoor scene the confidence that the image to be processed is an outdoor scene is obtained.
  • each scene category corresponds to the weight of the outdoor scene
  • each scene category corresponds to the weight of the indoor scene
  • the white point in the image to be processed can be determined based on the RGB values of the pixels of the image to be processed, and for the white point in each pixel block, the weight of the white point in the pixel block can be adjusted according to the scene category to which the pixel block belongs, Get the target weight, for example, for the white point of the sky, green plants, soil and other categories, you can reduce the weight of the white point, and for the scene category that may be a white point, such as outdoor roads, you can increase the weight of the white point, In order to achieve more accurate white finding.
  • the white balance gain can be determined based on the target weight and the RGB value of each white point.
  • the proportion Q4 of the area where the RGB value of the pixel block falls into the color interval of the confused color according to the size of the proportion Q4, the scene category to which the pixel block belongs, the ambient brightness, and the color corresponding to the previous frame of the image to be processed
  • the compensation coefficient is determined based on the mild tone, etc., and then the white balance gain determined in the previous step is compensated.
  • the white balance gain when compensating the white balance gain, it can also be divided into indoor and outdoor two-way processing. For indoor scenes and outdoor scenes, different compensation coefficients b1 and b2 are determined respectively, and then use b1 to determine the white balance in the indoor scene Compensate with gain 1 to obtain white balance gain 3, and then use b2 to compensate white balance gain 2 in the indoor scene determined in the previous step to obtain white balance gain 4.
  • step 3 it is determined that the image to be processed is the confidence degree of the indoor scene, and the confidence degree of the image to be processed is the outdoor scene, and the white balance gain 3 and the white balance gain 4 are weighted to obtain the final target white balance gain, which is used for the image to be processed.
  • the image is corrected.
  • the ambient color of the image can be further adjusted in combination with the color of the light source to obtain the target image, so that the color of the target image is more in line with the actual scene.
  • the embodiment of the present application also provides an image processing device. As shown in FIG. Executing computer program, when the processor 31 executes the computer program, the following steps can be realized:
  • the scene category information includes: a target object category to which the pixel block belongs and/or information indicating that the image to be processed is an indoor scene or an outdoor scene.
  • each object category in the preset plurality of object categories has at least one of the following characteristics:
  • Each object category can be used to determine that the image to be processed is an indoor scene or an outdoor scene
  • Each of the object categories can be used to determine the white point in the image to be processed
  • the color interval of the scene included in each object category overlaps with the color interval of at least one scene other than the scene.
  • the category of the target object to which the pixel block belongs is determined based on the following manner:
  • the determining the target object category to which the pixel block belongs from the plurality of object categories based on the target confidence degree includes:
  • the object category with the highest target confidence is taken as the target object category to which the pixel block belongs.
  • determining that the pixel block is a target confidence degree of each object category in a plurality of object categories includes:
  • For each object category determine the initial confidence that the pixel block is the object category based on the pre-trained neural network
  • For each object category determine the initial confidence that the pixel block is the object category based on a pre-trained neural network
  • the initial confidence is adjusted based on the pixel value related information of the pixel block to obtain the target confidence.
  • the pixel value-related information includes one or more of the following:
  • the target confidence level is positively related to the first proportion, and the target confidence level is positively related to the closeness of the luminance of the pixel block to the nominal luminance of the object category.
  • the target confidence level is 0.
  • the information indicating that the image to be processed is an indoor scene or an outdoor scene includes:
  • the confidence level that the image to be processed is an indoor scene, and/or the confidence level that the image to be processed is an outdoor scene.
  • the confidence that the image to be processed is an indoor scene or the confidence of an outdoor scene is determined based on the following manner:
  • the weight of each target object category for the indoor scene or the weight of each target object category for the indoor scene is determined based on one or more of the following: the brightness of all pixel blocks belonging to each target object category, and the The type of category.
  • the second ratio is determined based on the following methods:
  • the processor when the processor is configured to determine the target white balance gain based on the scene category information of the pixel block, it is specifically configured to:
  • the target white balance gain is determined based on the RGB value of the white point and the target weight.
  • the scene category information includes the target object category to which the pixel block belongs, and when the target object categories are different, the target weights are different; and/or
  • the scene category information includes information indicating that the image to be processed is an indoor scene or an outdoor scene, and the target weight of the image to be processed is an indoor scene, which is different from the target weight when the image to be processed is an outdoor scene. target weight.
  • the processor when the processor is configured to determine the target weight of the white point in the pixel block based on the scene category information of the pixel block, it is specifically configured to:
  • the initial weight is adjusted based on the scene category information of the pixel block to obtain the target weight of the white point in the pixel block.
  • the initial weight is determined based on at least one or more of the following: the brightness of the pixel block, and the color temperature corresponding to the pixel block, wherein the color temperature corresponding to the pixel block is determined based on the pixel The RGB value of the block is determined.
  • the scene category information includes: the confidence level that the image to be processed is an indoor scene, and/or the confidence level that the image to be processed is an outdoor scene, and the processor is configured to When determining the target white balance gain based on scene category information, it is specifically used for:
  • the first target weight of the white point in the pixel block is determined based on the RGB value of the white point and the first target weight to determine a first white balance gain
  • the second target weight of the white point in the pixel block is determined based on the RGB value of the white point and the second target weight to determine a second white balance gain
  • the processor when the processor is configured to determine the target white balance gain based on the scene category information of the pixel block, it is specifically configured to:
  • the initial white balance gain of the pixel block is calculated based on the scene category information of the pixel block. compensation to obtain the target white balance gain of the pixel block.
  • the processor is configured to compensate the initial white balance gain based on the scene category information of the pixel block, and when the target white balance gain is obtained, it is specifically used for:
  • the compensation coefficient is used to compensate the initial white balance gain to obtain the target white balance gain.
  • the scene category information includes the target object category to which the pixel block belongs, and the compensation coefficient is determined based on the following method:
  • the category of the target scene to which the pixel block belongs the brightness of the pixel block, the color temperature corresponding to the previous frame of the image to be processed, and the corresponding color temperature of the previous frame of the image to be processed
  • One or more of the hues determine the compensation coefficients.
  • the processor when the processor is used to determine the initial white balance gain of the image to be processed, it is specifically used for:
  • An initial white balance gain of the image to be processed is determined based on the RGB value of the white point and the target weight.
  • the scene category information includes the confidence that the image to be processed is an indoor scene, and the confidence that the image to be processed is an outdoor scene, and the compensation coefficient includes that the image to be processed is an indoor scene The first compensation coefficient under, and the image to be processed is the second compensation coefficient under an outdoor scene;
  • the processor is further configured to:
  • Ambient color processing is performed on the image to be processed after white balance correction processing.
  • an image acquisition device is also provided in an embodiment of the present application, and the image acquisition includes the image processing apparatus as described in any one of the above embodiments.
  • the image acquisition device can hold various devices such as pan-tilt cameras, mobile phones, and drones.
  • the embodiments of this specification further provide a computer storage medium, where a program is stored in the storage medium, and when the program is executed by a processor, the method in any of the foregoing embodiments is implemented.
  • Embodiments of the present description may take the form of a computer program product embodied on one or more storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) having program code embodied therein.
  • Computer usable storage media includes both volatile and non-permanent, removable and non-removable media, and may be implemented by any method or technology for information storage.
  • Information may be computer readable instructions, data structures, modules of a program, or other data.
  • Examples of storage media for computers include, but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • ROM read only memory
  • EEPROM Electrically Erasable Programmable Read-Only Memory
  • Flash memory or other memory technology
  • CD-ROM Compact Disc Read-Only Memory
  • DVD Digital Versatile Disc
  • Magnetic tape cartridge tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to
  • the device embodiment since it basically corresponds to the method embodiment, for related parts, please refer to the part description of the method embodiment.
  • the device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without creative effort.

Abstract

An image processing method and apparatus, an image acquisition device, and a storage medium. The method comprises: obtaining an image to be processed (S102); determining scene type information of pixel blocks in said image (S104); and on the basis of the scene type information of the pixel blocks, determining a target white balance gain, so as to perform white balance correction on said image by using the target white balance gain (S106). According to the method, it is assisted to determine a white balance gain by using the scene type information of the pixel blocks, so that a more accurate white balance gain can be obtained, and a more ideal white balance processing effect can further be obtained.

Description

图像处理方法、装置、图像采集设备及存储介质Image processing method, device, image acquisition device and storage medium 技术领域technical field
本申请涉及图像处理技术领域,具体而言,涉及一种图像处理方法、装置、图像采集设备及存储介质。The present application relates to the technical field of image processing, and in particular, to an image processing method, device, image acquisition device, and storage medium.
背景技术Background technique
在对图像进行白平衡处理时,可以基于图像中的白点的RGB值确定白平衡增益,进而利用白平衡增益对图像进行白平衡处理。所以,准确地确定白平衡增益,是提高图像白平衡处理效果的关键。相关技术中,通常是仅根据图像中像素点的RGB值确定白点和白平衡增益,这种方式得到的白平衡增益不够准确,导致图像白平衡处理效果较差。When white balance processing is performed on an image, a white balance gain may be determined based on RGB values of white points in the image, and then white balance processing is performed on the image by using the white balance gain. Therefore, accurately determining the white balance gain is the key to improving the effect of image white balance processing. In the related art, the white point and the white balance gain are usually determined only according to the RGB values of the pixels in the image, and the white balance gain obtained in this way is not accurate enough, resulting in poor image white balance processing effect.
发明内容Contents of the invention
有鉴于此,本申请提供一种图像处理方法、装置、图像采集设备及存储介质。In view of this, the present application provides an image processing method, device, image acquisition device and storage medium.
根据本申请的第一方面,提供一种图像处理方法,所述方法包括:According to a first aspect of the present application, an image processing method is provided, the method comprising:
获取待处理图像;Get the image to be processed;
确定所述待处理图像中的像素块的场景类别信息;determining scene category information of pixel blocks in the image to be processed;
基于所述像素块的场景类别信息确定目标白平衡增益,以利用所述目标白平衡增益对所述待处理图像进行白平衡校正。Determine a target white balance gain based on the scene category information of the pixel block, so as to perform white balance correction on the image to be processed by using the target white balance gain.
根据本申请的第二方面,提供一种图像处理装置,所述装置包括处理器、存储器、存储于所述存储器中可供所述处理器执行的计算机程序,所述处理器执行所述计算机程序时可实现以下步骤:According to the second aspect of the present application, there is provided an image processing device, the device includes a processor, a memory, and a computer program stored in the memory that can be executed by the processor, and the processor executes the computer program The following steps can be implemented:
获取待处理图像;Get the image to be processed;
确定所述待处理图像中的像素块的场景类别信息;determining scene category information of pixel blocks in the image to be processed;
基于所述像素块的场景类别信息确定目标白平衡增益,以利用所述目标 白平衡增益对所述待处理图像进行白平衡校正。Determine a target white balance gain based on the scene category information of the pixel block, so as to use the target white balance gain to perform white balance correction on the image to be processed.
根据本申请的第三方面,提供一种图像采集设备,所述图像采集设备包括上述第二方面提及的图像处理装置。According to a third aspect of the present application, an image acquisition device is provided, and the image acquisition device includes the image processing apparatus mentioned in the second aspect above.
根据本申请的第四方面,提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被执行时实现上述第一方面提及的方法。According to a fourth aspect of the present application, a computer-readable storage medium is provided, and a computer program is stored on the computer-readable storage medium, and when the computer program is executed, the method mentioned in the above-mentioned first aspect is implemented.
应用本申请提供的方案,在确定用于对图像进行白平衡校正的白平衡增益时,考虑到仅根据图像RGB值确定的白平衡增益不够准确,因而,可以先确定待处理图像中各像素块的场景类别信息,然后结合各像素块的场景类别信息辅助确定白平衡增益,从而可以得到更加准确的白平衡增益,进而可以得到更加理想的白平衡处理效果。Applying the scheme provided by this application, when determining the white balance gain for white balance correction of the image, considering that the white balance gain determined only based on the RGB value of the image is not accurate enough, it is possible to first determine the pixel block in the image to be processed The scene category information of each pixel block is combined with the scene category information to assist in determining the white balance gain, so that a more accurate white balance gain can be obtained, and a more ideal white balance processing effect can be obtained.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1是本申请一个实施例的图像处理方法的流程图。Fig. 1 is a flowchart of an image processing method according to an embodiment of the present application.
图2是本申请一个实施例的图像处理方法的示意图。Fig. 2 is a schematic diagram of an image processing method according to an embodiment of the present application.
图3是本申请一个实施例的图像处理装置的逻辑结构的示意图。Fig. 3 is a schematic diagram of a logical structure of an image processing device according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the application with reference to the drawings in the embodiments of the application. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
在对图像进行白平衡处理时,可以基于图像中的白点的RGB值确定白平衡增益,进而利用白平衡增益对图像进行白平衡处理。准确地确定白平衡增益,是提高图像白平衡处理效果的关键。相关技术中,通常是仅根据图像的RGB值确定图像中的白点,进而确定白平衡增益,这种方式得到的白平衡增益往往不够准确。When white balance processing is performed on an image, a white balance gain may be determined based on RGB values of white points in the image, and then white balance processing is performed on the image by using the white balance gain. Accurate determination of white balance gain is the key to improve the effect of image white balance processing. In related technologies, the white point in the image is usually determined only according to the RGB values of the image, and then the white balance gain is determined. The white balance gain obtained in this way is often not accurate enough.
举个例子,白平衡校正的原理,是希望找到图像中白色的物体,然后将这些物体的颜色还原成白色。然而,仅基于图像的RGB值往往无法准确确定图像中的白色物体,比如,针对RGB值近似的像素块,其可能为不同的场景,比如,黄色光源下的白色物体和黄色物体的RGB值很相似,但是两者一个是白色,一个是非白色,因而在判定白点时容易出现误判,此外,针对RGB值相近的像素块,在室内场景和室外场景,该像素块为白色物体的概率是不一样的,或者说在雨天场景或阴天场景,其为白色物体的概率也不一样。因而,如果仅根据图像块的RGB值确定白平衡增益,可能误将一些不是白色物体的像素点确定为白点,或者将白色物体对应的像素点误判成非白点,进而导致确定的白平衡增益不够准确,白平衡处理后的图像效果不够理想。For example, the principle of white balance correction is to find the white objects in the image, and then restore the color of these objects to white. However, it is often impossible to accurately determine the white object in the image only based on the RGB value of the image. For example, for pixel blocks with similar RGB values, they may be different scenes. For example, the RGB values of white objects and yellow objects under yellow light sources are very different. Similar, but one of the two is white and the other is non-white, so it is easy to misjudge when determining the white point. In addition, for pixel blocks with similar RGB values, in indoor scenes and outdoor scenes, the probability of this pixel block being a white object is It is different, or in a rainy day scene or a cloudy day scene, the probability of being a white object is also different. Therefore, if the white balance gain is determined only according to the RGB value of the image block, some pixels that are not white objects may be mistakenly determined as white points, or the pixels corresponding to white objects may be misjudged as non-white points, resulting in a certain white The balance gain is not accurate enough, and the image effect after white balance processing is not ideal.
基于此,本申请实施例提供了一种图像处理方法,在确定用于对图像进行白平衡校正的白平衡增益时,考虑到仅根据图像RGB值确定的白平衡增益不够准确,因而,可以先确定待处理图像中各像素块的场景类别信息,然后结合各像素块的场景类别信息辅助确定白平衡增益,从而可以得到更加准确的白平衡增益,进而可以得到更加理想的白平衡处理效果。Based on this, the embodiment of the present application provides an image processing method. When determining the white balance gain used for white balance correction on the image, considering that the white balance gain determined only based on the RGB values of the image is not accurate enough, it can first Determine the scene category information of each pixel block in the image to be processed, and then combine the scene category information of each pixel block to assist in determining the white balance gain, so that a more accurate white balance gain can be obtained, and a more ideal white balance processing effect can be obtained.
本申请实施例的图像处理方法可以由图像采集设备执行,比如,可以由图像采集设备中的ISP芯片执行,或者也可以由图像采集设备采集图像后,发送给其他设备,由其他设备上的图像处理软件执行。The image processing method in the embodiment of the present application can be executed by the image acquisition device, for example, it can be executed by the ISP chip in the image acquisition device, or the image can be collected by the image acquisition device and sent to other devices. Process software execution.
如图1所示,为本申请实施例提供的图像处理方法的流程图,具体可以包括以下步骤:As shown in Figure 1, the flow chart of the image processing method provided by the embodiment of the present application may specifically include the following steps:
S102、获取待处理图像;S102. Obtain an image to be processed;
在步骤S102中,可以获取待处理图像,其中,待处理图像可以是各种需要进行白平衡校正处理的图像。In step S102, images to be processed may be acquired, where the images to be processed may be various images that require white balance correction processing.
S104、确定所述待处理图像中的像素块的场景类别信息;S104. Determine scene category information of pixel blocks in the image to be processed;
在步骤S104中,可以确定待处理图像中的像素块的场景类别信息,其中,场景类别信息可以是各种指示像素块所属的场景类别的信息,该场景类别可以采用各种方式对场景进行分类得到。比如,场景类别信息可以是指示像素块具体属于哪种物体类别的信息,比如,可以是指示像素块是绿植、天空、地面等各种类别的信息。或者场景类别信息也可以是指示待处理图像整体所属的场景类别的信息,比如,指示待处理图像是室内场景还是室外场景、是晴天场景或雨天场景等信息。不难理解,任何有助于辅助判定图像的白平衡增益的场景类别信息均在本申请实施例的保护范围内。In step S104, the scene category information of the pixel block in the image to be processed can be determined, wherein the scene category information can be various information indicating the scene category to which the pixel block belongs, and the scene category can classify the scene in various ways get. For example, the scene category information may be information indicating which object category the pixel block specifically belongs to, for example, it may be information indicating that the pixel block is of various categories such as green plants, sky, and ground. Alternatively, the scene category information may also be information indicating the scene category to which the entire image to be processed belongs, for example, indicating whether the image to be processed is an indoor scene or an outdoor scene, whether it is a sunny scene or a rainy scene, and the like. It is not difficult to understand that any scene category information that helps to assist in determining the white balance gain of an image falls within the scope of protection of the embodiments of the present application.
其中,待处理图像中的像素块,可以是将待处理图像按照一定大小划分得到的像素块,比如,可以将待处理划分成32×32的像素块,或其他尺寸的像素块,具体可以根据实际需求设置。确定像素块的场景类别信息可以是确定待处理图像中全部像素块的场景类别信息,或者也可以只确定部分像素块的场景类别信息,比如,针对有些像素块,可以基于RGB值准确判定其是否属于白点,则无需再确定这些像素块的场景类别信息。Wherein, the pixel block in the image to be processed may be a pixel block obtained by dividing the image to be processed according to a certain size, for example, the pixel block to be processed may be divided into 32×32 pixel blocks, or pixel blocks of other sizes, specifically according to Actual demand setting. Determining the scene category information of the pixel blocks may be to determine the scene category information of all the pixel blocks in the image to be processed, or only determine the scene category information of some pixel blocks. For example, for some pixel blocks, it can be accurately determined based on RGB values whether they are belong to white points, there is no need to determine the scene category information of these pixel blocks.
确定像素块的场景类别信息的方式有多种,比如,可以采用预先训练的神经网络对图像进行语义分割,或者也可以采用其他的方式确定,本申请实施例不做限制。There are many ways to determine the scene category information of the pixel block. For example, a pre-trained neural network can be used to perform semantic segmentation on the image, or other ways can be used, which are not limited in the embodiment of the present application.
S106、基于所述像素块的场景类别信息确定目标白平衡增益,以利用所述目标白平衡增益对所述待处理图像进行白平衡校正。S106. Determine a target white balance gain based on the scene category information of the pixel block, so as to perform white balance correction on the image to be processed by using the target white balance gain.
在步骤S106中,在确定像素块的场景类别信息后,可以利用像素块的场景类别信息辅助确定目标白平衡增益。比如,可以结合像素块的场景类别信息确定该像素块的像素点是否为白点,进而基于确定的白点确定目标白平衡增益,或者,也可以在确定图像中的白点后,进一步结合像素块的场景类别信息判定各白点对应的权重,结合白点对应的权重和RGB值确 定目标白平衡增益,或者也可以在确定白平衡增益后,基于像素块的场景类别信息对白平衡增益进行调整,得到最终的目标白平衡增益,进而利用确定的目标白平衡增益对待处理图像进行白平衡校正。In step S106, after the scene category information of the pixel block is determined, the scene category information of the pixel block may be used to assist in determining the target white balance gain. For example, it can be combined with the scene category information of the pixel block to determine whether the pixel point of the pixel block is a white point, and then determine the target white balance gain based on the determined white point, or, after determining the white point in the image, further combine the pixel Determine the weight corresponding to each white point based on the scene category information of the block, and determine the target white balance gain by combining the weight corresponding to the white point and the RGB value, or adjust the white balance gain based on the scene category information of the pixel block after determining the white balance gain , to obtain the final target white balance gain, and then use the determined target white balance gain to perform white balance correction on the image to be processed.
本申请实施例通过确定图像中像素块的场景类别信息,进而可以基于场景类别信息确定白平衡增益,使得确定的白平衡增益更加准确,可以达到更好的白平衡处理效果。In the embodiment of the present application, by determining the scene category information of the pixel blocks in the image, the white balance gain can be determined based on the scene category information, so that the determined white balance gain is more accurate, and a better white balance processing effect can be achieved.
在一些实施例中,场景类别信息可以包括像素块所属的目标物体类别,比如,该像素块是天空、草地、道路、车辆、人物等具体哪种类别,结合像素块所属的目标物体类别,可以辅助判定像素块是不是白点,或者像素块为白点的概率的大小,进而可以准确确定白平衡增益。In some embodiments, the scene category information may include the category of the target object to which the pixel block belongs, for example, the specific category of the pixel block is sky, grass, road, vehicle, person, etc., combined with the target object category to which the pixel block belongs, can be It assists in determining whether the pixel block is a white point, or the probability of the pixel block being a white point, and then can accurately determine the white balance gain.
在一些实施例中,场景类别信息可以是指示待处理图像为室内场景或室外场景的信息。由于在确定白平衡增益时,待处理图像为室内场景或室外场景等不同情况时,也会对白平衡增益的确定存在一定的影响,比如,同样是白点,在室外场景,其亮度会大一些,在室内场景,其亮度偏暗一些,所以,针对RGB相同的像素点,在室外场景和室内场景时,其为白点的概率不一样。因而可以基于指示待处理图像为室内场景或室外场景的信息准确确定像素块中的白点,或者利用该信息对白平衡增益进行调整,得到准确的白平衡增益。In some embodiments, the scene category information may be information indicating that the image to be processed is an indoor scene or an outdoor scene. When determining the white balance gain, when the image to be processed is an indoor scene or an outdoor scene, it will also have a certain impact on the determination of the white balance gain. For example, if it is the same white point, its brightness will be larger in the outdoor scene , in the indoor scene, its brightness is darker, so for the same RGB pixel, the probability of being a white point is different in the outdoor scene and the indoor scene. Therefore, the white point in the pixel block can be accurately determined based on the information indicating that the image to be processed is an indoor scene or an outdoor scene, or the information can be used to adjust the white balance gain to obtain an accurate white balance gain.
由于物体类别比较多,在确定像素块所属的目标物体类别时,我们希望所确定的目标物体类别能够对确定白平衡增益有帮助,即这些物体类别对白平衡增益有影响,可以用于辅助确定白平衡增益。所以,在一些实施例中,可以预先设置多个物体类别,然后判定像素块为预设的多个物体类别中的具体类别,比如,该多个物体类别可以是以下几类:天空、建筑、绿植、泥土、马路、地板、其他。在设置这多个物体类别时,可以基于以下几个原则去设置:Since there are many object categories, when determining the target object category to which the pixel block belongs, we hope that the determined target object category can help determine the white balance gain, that is, these object categories have an impact on the white balance gain, and can be used to assist in determining the white balance gain. Balance gain. Therefore, in some embodiments, multiple object categories can be preset, and then the pixel block is determined to be a specific category in the preset multiple object categories. For example, the multiple object categories can be the following categories: sky, building, Green plants, soil, roads, floors, others. When setting these multiple object categories, you can set them based on the following principles:
(1)预先设置的物体类别可用于确定待处理图像为室内场景或室外场景,比如,预先设置的物体类别可以是天空(可以确定是室外场景),地板 (可以确定是室内场景),或者其他可以用于确定室内场景或室外场景的其他类别。由于室内外场景对白平衡增益的确定存在影响,因而,基于像素块是否属于这些类别可以辅助确定目标白平衡增益。(1) The preset object category can be used to determine whether the image to be processed is an indoor scene or an outdoor scene. For example, the preset object category can be the sky (can be determined to be an outdoor scene), the floor (can be determined to be an indoor scene), or other Other categories that can be used to determine indoor or outdoor scenes. Since indoor and outdoor scenes have an impact on the determination of the white balance gain, determining the target white balance gain can be assisted based on whether the pixel blocks belong to these categories.
(2)预先设置的物体类别可用于确定待处理图像中的白点,比如,准确确定白点是准确确定白平衡增益的前提,如果可以结合像素块所属的目标物体类别准确确定白点,势必会提高确定的白平衡增益的准确度。所以,预先设置的物体类别是可以辅助确定像素点是不是白点的类别,比如,太阳,如果确定该像素块为太阳,那么该像素块中的像素点为白点。(2) The pre-set object category can be used to determine the white point in the image to be processed. For example, accurately determining the white point is a prerequisite for accurately determining the white balance gain. If the white point can be accurately determined in combination with the target object category to which the pixel block belongs, it is bound to Will improve the accuracy of the determined white balance gain. Therefore, the preset object category is a category that can assist in determining whether a pixel is a white point, for example, the sun, if the pixel block is determined to be the sun, then the pixel in the pixel block is a white point.
(3)预先设置的物体类别包含的场景的颜色区间与至少一种除该场景以外的其他场景的颜色区间存在重叠区域。由于存在两种物体对应的颜色区间存在重叠的情况,比如,黄色物体和黄色光源下的白色物体、绿植和荧光光源下的白色物体、天空和蓝色光源下的白色物体等,这些物体对应的颜色区间存在重叠,因而仅根据RGB值无法确定其到底是不是白点,如果可以确定像素块是否属于这些类别,进而可以辅助确定白点,或者辅助确定白平衡增益,从而可以得到准确的白平衡增益。比如,这些物体类别可以是天空、绿植、雪景等会与其他场景混淆的类别。(3) There is an overlapping area between the color interval of the scene included in the preset object category and at least one color interval of other scenes except the scene. Since there are overlapping color intervals corresponding to two objects, for example, a yellow object and a white object under a yellow light source, a white object under a green plant and a fluorescent light source, and a white object under the sky and a blue light source, etc., these objects correspond to There are overlaps in the color intervals, so it is impossible to determine whether it is a white point based only on the RGB value. If it can be determined whether the pixel block belongs to these categories, it can assist in determining the white point, or assist in determining the white balance gain, so that an accurate white can be obtained. Balance gain. For example, these object categories can be categories such as sky, green plants, snow scenes, etc. that will be confused with other scenes.
在一些实施例中,在确定像素块所属的目标物体类别时,可以分别确定像素块为预设的多个物体类别中的每个物体类别的目标置信度,然后基于该目标置信度从所述多个物体类别中确定像素块所属的目标物体类别。比如,预设的多个物体类别为天空、建筑、绿植、泥土、马路、地板、其他,因而可以确定各像素块为上述每种类别的目标置信度,进而基于该目标置信度确定像素块所属的目标物体类别。In some embodiments, when determining the target object category to which the pixel block belongs, the pixel block can be respectively determined as the target confidence level of each object category in the preset plurality of object categories, and then based on the target confidence level, the A target object category to which the pixel block belongs is determined among the plurality of object categories. For example, the preset multiple object categories are sky, building, green plant, soil, road, floor, and others, so it is possible to determine the target confidence of each pixel block for each of the above categories, and then determine the pixel block based on the target confidence The target object class to which it belongs.
比如,在一些实施例中,可以直接将目标置信度最大的物体类别作为该像素块所属的目标物体类别。或者,在一些实施例中,也可以基于各像素块为上述每种类别的目标置信度,以及该像素块的邻近像素块所属的目标物体类别确定该像素块所属的目标物体类别。比如,该像素块属于天空的置信度为80%,属于马路的置信度为85%,而其邻近像素块均为天空, 则,认为该像素块也属于天空。For example, in some embodiments, the object category with the highest target confidence may be directly used as the target object category to which the pixel block belongs. Alternatively, in some embodiments, the target object category to which the pixel block belongs may also be determined based on the target confidence of each pixel block for each of the above categories and the target object categories to which the adjacent pixel blocks of the pixel block belong. For example, if the confidence that the pixel block belongs to the sky is 80%, and the confidence that it belongs to the road is 85%, and its adjacent pixel blocks are all sky, then the pixel block is considered to belong to the sky.
在一些实施例中,在确定像素块为多个物体类别中的每个物体类别的目标置信度时,可以针对每个物体类别,分别确定像素块为该物体类别的初始置信度,比如,可以基于预先训练的神经网络确定像素块为该物体类别的初始置信度,或者也可以采用其他方式确定初始置信度,然后直接将该初始置信度作为目标置信度。In some embodiments, when determining the target confidence that the pixel block is each object category in multiple object categories, for each object category, the initial confidence that the pixel block is the object category can be determined respectively, for example, Determine the initial confidence that the pixel block is the object category based on the pre-trained neural network, or determine the initial confidence in other ways, and then directly use the initial confidence as the target confidence.
在一些实施例中,基于神经网络或其他方式确定的初始置信度可能不太准确,因而,在确定初始置信度后,可以基于像素块自身的像素值相关的信息进一步对初始置信度进行调整,以得到更加准确的目标置信度。In some embodiments, the initial confidence determined based on the neural network or other methods may not be accurate. Therefore, after the initial confidence is determined, the initial confidence can be further adjusted based on the information related to the pixel value of the pixel block itself, In order to get a more accurate target confidence.
在一些实施例中,像素值相关信息可以包括以下一种或多种:该像素块的亮度、该像素块中第一指定像素区域的第一占比,其中,第一指定像素区域的RGB值落入该场景类别对应的颜色区间内。比如,针对每个物体类别,可以预先标定该物体类别的亮度,比如,天空的亮度为A,当像素块的亮度和A越接近,说明该像素块为天空的置信度越大,因而可以基于该接近程度对初始置信度进行调整,得到较为准确的目标置信度。In some embodiments, the pixel value-related information may include one or more of the following: the brightness of the pixel block, the first proportion of the first specified pixel area in the pixel block, wherein the RGB value of the first specified pixel area fall within the color range corresponding to the scene category. For example, for each object category, the brightness of the object category can be pre-calibrated. For example, the brightness of the sky is A. When the brightness of the pixel block is closer to A, the confidence that the pixel block is the sky is greater, so it can be based on The degree of proximity adjusts the initial confidence to obtain a more accurate target confidence.
再比如,针对每个物体类别,可以确定每个物体类别对应的颜色区间,比如,可以预先标定每个物体类别的颜色区间,或者也可以基于其他方式得到。假设确定天空的颜色区间为B,然后,可以基于像素块中落入该颜色区间的第一指定像素区域在整个像素块中的第一占比,第一占比越大,说明该像素块为天空的置信度越大,因而可以基于该第一占比的大小对初始置信度进行调整,得到较为准确的目标置信度。For another example, for each object category, the color interval corresponding to each object category can be determined, for example, the color interval of each object category can be pre-marked, or can also be obtained based on other methods. Assuming that the color interval of the sky is determined to be B, then, based on the first ratio of the first specified pixel area in the pixel block that falls into the color interval in the entire pixel block, the larger the first ratio, it means that the pixel block is The greater the confidence of the sky, the initial confidence can be adjusted based on the size of the first proportion to obtain a more accurate target confidence.
在一些实施例中,目标置信度正相关于像素块的亮度与物体类别的标定亮度的接近程度。当像素块的亮度和标定亮度越接近,说明该像素块为该种物体类别的置信度越大。In some embodiments, the target confidence is directly related to how close the brightness of the pixel block is to the nominal brightness of the object class. When the luminance of the pixel block is closer to the calibrated luminance, it means that the confidence of the pixel block is the object category is greater.
在一些实施例中,目标置信度正相关于该第一占比,第一占比越大,说明该像素块为该种物体类别的置信度越大。In some embodiments, the target confidence is positively related to the first proportion, and the larger the first proportion, the greater the confidence that the pixel block belongs to the object category.
当然,在一些实施例中,如果像素块的亮度很小,比如,像素块的亮 度小于预设亮度阈值,那么基于神经网络确定的初始置信度是不准确的,所以,可以将目标置信度调整为0。Of course, in some embodiments, if the brightness of the pixel block is very small, for example, the brightness of the pixel block is less than the preset brightness threshold, then the initial confidence determined based on the neural network is inaccurate, so the target confidence can be adjusted is 0.
在一些实施例中,指示待处理图像为室内场景或室外场景的信息可以是待处理图像为室内场景的置信度、待处理图像为室外场景的置信度中的一种或多种。In some embodiments, the information indicating that the image to be processed is an indoor scene or an outdoor scene may be one or more of a confidence level that the image to be processed is an indoor scene, and a confidence level that the image to be processed is an outdoor scene.
在一些实施例中,待处理图像为室内场景的置信度或室外场景的置信度可以通过以下方式确定:首先,可以基于待处理图像中各像素块所属的目标物体类别确定属于各个目标物体类别的所有像素块在待处理图像中的第二占比,然后基于第二占比、以及各个目标物体类别对于室内场景的权重确定待处理图像为室内场景的置信度。同样的,可以基于该第二占比、以及各个目标物体类别对于室外场景的权重确定待处理图像为室外场景的置信度。In some embodiments, the confidence degree of the image to be processed is an indoor scene or the confidence degree of an outdoor scene can be determined in the following manner: First, the object belonging to each target object category can be determined based on the target object category to which each pixel block in the image to be processed belongs. The second ratio of all pixel blocks in the image to be processed is determined based on the second ratio and the weight of each target object category for the indoor scene to determine the confidence that the image to be processed is an indoor scene. Similarly, the confidence that the image to be processed is an outdoor scene may be determined based on the second proportion and the weights of each target object category for the outdoor scene.
举个例子,假设待处理图像中包括100个大小相同的像素块,其中,50个像素块所属的目标物体类别为天空、30个像素块所属的目标物体类别为绿植,10个像素块所属的目标物体类别为道路,10个像素块所属的目标物体类别为其他。因而,可以确定待处理图像中天空区域的第二占比为50%,绿植区域的第二占比为30%,道路区域的第二占比为10%、其他类别区域的第二占比为10%。然后可以确定各场景相对于室内场景和室外场景的权重,假设,天空对于室内场景的权重为20%、对于室外的权重为80%、绿植对于室内场景的权重为40%、对于室外的权重为60%等,进而可以基于该第二占比和权重确定待处理图像为室内场景的置信度,比如,0.2,以及为室外场景的置信度,比如,0.8。For example, suppose the image to be processed includes 100 pixel blocks of the same size, among which, 50 pixel blocks belong to the target object category of the sky, 30 pixel blocks belong to the target object category of green plants, and 10 pixel blocks belong to The target object category of is road, and the target object category to which the 10 pixel blocks belong is other. Therefore, it can be determined that the second proportion of the sky area in the image to be processed is 50%, the second proportion of the green plant area is 30%, the second proportion of the road area is 10%, and the second proportion of other types of areas 10%. Then the weight of each scene relative to the indoor scene and the outdoor scene can be determined. Assume that the weight of the sky is 20% for the indoor scene, 80% for the outdoor scene, 40% for the indoor scene, and 40% for the outdoor scene. 60%, etc., and then based on the second ratio and weight, the confidence level that the image to be processed is an indoor scene, for example, 0.2, and the confidence level for an outdoor scene, such as 0.8, can be determined.
其中,各个目标物体类别对于室内场景的权重或各个目标物体类别对于室内场景的权重可以预先设置,或者,在一些实施例中,为了得到更加准确的权重,也可以基于属于各个目标物体类别的所有像素块的亮度、以及各个目标物体类别的类型中的一种或多种确定。Wherein, the weight of each target object category for the indoor scene or the weight of each target object category for the indoor scene can be preset, or, in some embodiments, in order to obtain a more accurate weight, it can also be based on all objects belonging to each target object category. One or more of the brightness of the pixel block and the type of each target object category are determined.
在一些实施例中,在确定属于各个目标物体类别的所有像素块在待处 理图像中的第二占比时,如果仅基于待处理图像一帧图像确定,由于图像存在噪声等原因,确定的结果可能不太准确。因而,可以结合在待处理图像前后采集的多帧图像确定第二占比。比如,可以获取在处待处理图像之前和/或之后采集的多帧目标图像,对多帧目标图像中属于各个目标物体类别的所有像素块的占比,以及待处理图像中属于各个目标物体类别的像素块的占比进行滤波处理,得到第二占比。比如,确定多帧目标图像中天空的占比,以及待处理图像中天空的占比,然后对这些图像中天空的占比进行滤波处理,比如,求平均或者加权平均,得到最终的第二占比。针对其他的类别,也可以采用类似的方式。In some embodiments, when determining the second ratio of all pixel blocks belonging to each target object category in the image to be processed, if it is determined based on only one frame of the image to be processed, due to reasons such as noise in the image, the determined result Might not be very accurate. Therefore, the second proportion may be determined in combination with multiple frames of images collected before and after the image to be processed. For example, multiple frames of target images collected before and/or after the image to be processed can be obtained, the proportion of all pixel blocks belonging to each target object category in the multiple frames of target images, and the proportion of all pixel blocks belonging to each target object category in the image to be processed The proportion of the pixel block is filtered to obtain the second proportion. For example, determine the proportion of the sky in the multi-frame target image and the proportion of the sky in the image to be processed, and then filter the proportion of the sky in these images, for example, calculate the average or weighted average, and obtain the final second proportion Compare. Similar methods can also be used for other categories.
在一些实施例中,在基于像素块的场景类别信息确定目标白平衡增益时,可以先基于像素块所属的目标物体类别确定像素块中的白点的目标权重,然后基于待处理图像中各白点的RGB值和各目标权重确定目标白平衡增益。比如,可以基于待处理图像中像素点的RGB值,初步确定图像中的白点,然后可以进一步结合各像素块的场景类别信息确定白点对应的权重,比如,如果确定像素块所属的类别是天空,由于天空色温较高,在被当成白点时会拉高最终结果的色温导致色彩偏黄,因此可以适当降低该像素块中白点的权重。在基于白点的RGB计算白平衡增益时,可以结合该权重对各白点确定的白平衡增益进行加权平均处理,以得到最终的目标白平衡增益。In some embodiments, when determining the target white balance gain based on the scene category information of the pixel block, the target weight of the white point in the pixel block can be determined first based on the target object category to which the pixel block belongs, and then based on each white point in the image to be processed The RGB values of the points and the respective target weights determine the target white balance gain. For example, based on the RGB values of the pixels in the image to be processed, the white point in the image can be initially determined, and then the weight corresponding to the white point can be further combined with the scene category information of each pixel block. For example, if it is determined that the category to which the pixel block belongs is The sky, because the color temperature of the sky is high, when it is regarded as a white point, the color temperature of the final result will be raised, resulting in a yellowish color, so the weight of the white point in this pixel block can be appropriately reduced. When calculating the white balance gain based on the RGB of the white point, weighted average processing may be performed on the white balance gains determined by each white point in combination with the weight, so as to obtain the final target white balance gain.
在一些实施例中,场景类别信息包括像素块所属的目标物体类别,像素块所属的目标物体类别不同时,该像素块中的白点对应的目标权重也不同。在一些实施中,场景类别信息也可以包括指示待处理图像为室内场景或室外场景的信息,待处理图像为室内场景或室外场景两种不同情况时,待处理图像中各像素块的白点的目标权重也不同。In some embodiments, the scene category information includes the target object category to which the pixel block belongs. When the target object category to which the pixel block belongs is different, the target weights corresponding to the white points in the pixel block are also different. In some implementations, the scene category information may also include information indicating that the image to be processed is an indoor scene or an outdoor scene. When the image to be processed is an indoor scene or an outdoor scene, the white point of each pixel block in the image to be processed The target weights are also different.
在一些实施例中,在基于像素块的场景类别信息确定像素块中的白点的目标权重时,可以先确定像素块中的白点的初始权重,然后可以基于像素块的场景类别信息,比如,像素块所属的目标物体类别、待处理图像为 室内场景或者室外场景等对初始权重进行调整,得到像素块中的白点的目标权重。In some embodiments, when determining the target weight of the white point in the pixel block based on the scene category information of the pixel block, the initial weight of the white point in the pixel block can be determined first, and then based on the scene category information of the pixel block, such as , the target object category to which the pixel block belongs, whether the image to be processed is an indoor scene or an outdoor scene etc. adjust the initial weights to obtain the target weight of the white point in the pixel block.
比如,在一些实施例中,在确定白点的初始权重时,可以基于像素块的亮度、以及像素块对应的色温中的一种或者多种确定像素块中的白点的初始权重,其中,RGB值与色温的对应关系可以预先标定好,然后可以根据像素块的RGB值确定像素块对应的色温。For example, in some embodiments, when determining the initial weight of the white point, the initial weight of the white point in the pixel block may be determined based on one or more of the brightness of the pixel block and the color temperature corresponding to the pixel block, wherein, The corresponding relationship between the RGB value and the color temperature can be calibrated in advance, and then the color temperature corresponding to the pixel block can be determined according to the RGB value of the pixel block.
为了得到较好的白平衡处理效果,当待处理图像分别属于室内场景和室外场景时,同一像素块中白点对应的目标权重可以设置得不一样。所以,在一些实施例中,场景类别信息可以包括待处理图像为室内场景的置信度、和/或待处理图像为室外场景的置信度,然后可以针对室内场景和室外场景两种情况,分两路进行处理,得到最终的目标白平衡增益。比如,可以确定待处理图像为室外场景时,像素块中的白点的第一目标权重,然后根据整个待处理图像中白点的RGB值和该第一目标权重确定第一白平衡增益,同时,可以确定待处理图像为室内场景时,像素块中的白点的第二目标权重,然后根据整个待处理图像中白点的RGB值和第二目标权重确定第二白平衡增益。然后可以基于待处理图像为室内场景的置信度、待处理图像为室外场景的置信度,对第一白平衡增益和第二白平衡增益进行加权处理得到目标白平衡增益。通过对室内场景和室外场景区分处理,分两路处理得到两个种场景下的白平衡增益,然后可以基于待处理图像属于上述两种场景的置信度得到一个综合的白平衡增益,使得最终确定的白平衡增益更加准确。In order to obtain a better white balance processing effect, when the images to be processed belong to indoor scenes and outdoor scenes respectively, the target weights corresponding to the white points in the same pixel block can be set differently. Therefore, in some embodiments, the scene category information may include the confidence level that the image to be processed is an indoor scene, and/or the confidence level that the image to be processed is an outdoor scene. process to obtain the final target white balance gain. For example, when the image to be processed is an outdoor scene, the first target weight of the white point in the pixel block can be determined, and then the first white balance gain is determined according to the RGB value of the white point in the entire image to be processed and the first target weight, and at the same time When the image to be processed is an indoor scene, the second target weight of the white point in the pixel block can be determined, and then the second white balance gain can be determined according to the RGB value of the white point in the entire image to be processed and the second target weight. Then, based on the confidence that the image to be processed is an indoor scene and the confidence that the image to be processed is an outdoor scene, the first white balance gain and the second white balance gain may be weighted to obtain a target white balance gain. By distinguishing the indoor scene from the outdoor scene, the white balance gains in the two scenes are obtained by two-way processing, and then a comprehensive white balance gain can be obtained based on the confidence that the image to be processed belongs to the above two scenes, so that the final determination The white balance gain is more accurate.
相关技术中,在确定白平衡增益时,并没考虑到有些场景的颜色区间较为接近,存在混淆的问题。比如,黄色物体与黄色灯光下的白色物体、蓝色物体与蓝色灯光下的白色物体、绿植与荧光光源下的白色物体、雪景与蓝天等场景,由于其颜色区间很接近,容易混淆,导致无法确定该像素块真实的场景类别,进而导致确定的白平衡增益不准确。In the related art, when determining the white balance gain, it does not take into account that the color intervals of some scenes are relatively close, and there is a problem of confusion. For example, scenes such as yellow objects and white objects under yellow light, blue objects and white objects under blue light, green plants and white objects under fluorescent light sources, snow scenes and blue sky are easy to confuse due to their close color intervals. As a result, it is impossible to determine the real scene category of the pixel block, which in turn leads to inaccurate white balance gain determination.
为了解决上述问题,在确定待处理图像的白平衡增益以后,可以进一 步基于像素块的场景类别信息对确定的白平衡增益进行补偿,以消除由于颜色区间接近导致场景混淆,对白平衡增益产生的影响。比如,在基于像素块的场景类别信息确定目标白平衡增益时,可以先确定待处理图像的初始白平衡增益,然后针对每个像素块,判定该像素块的RGB值是否落入混淆色的颜色区间,其中,混淆色的颜色区间可以预先设置好,比如,常见的易混淆的场景,以及这些场景的颜色区间可以预先确定,像素块的RGB值落入这些颜色区间,则说明该像素块所属的场景类别存在混淆的可能。然后可以基于像素块的场景类别信息对像素块的初始白平衡增益进行补偿,得到该像素块的目标白平衡增益,进而利用目标白平衡增益对该像素块进行白平衡校正处理。In order to solve the above problems, after determining the white balance gain of the image to be processed, the determined white balance gain can be further compensated based on the scene category information of the pixel block, so as to eliminate the influence of the white balance gain on the white balance gain caused by the scene confusion caused by the close color range . For example, when determining the target white balance gain based on the scene category information of the pixel block, the initial white balance gain of the image to be processed can be determined first, and then for each pixel block, it is determined whether the RGB value of the pixel block falls into the color of the confused color Interval, where the color interval of the confusing color can be set in advance, for example, common confusing scenes, and the color interval of these scenes can be predetermined, if the RGB value of the pixel block falls into these color intervals, it means that the pixel block belongs to There is a possibility of confusion in the category of the scene. Then, the initial white balance gain of the pixel block can be compensated based on the scene category information of the pixel block to obtain the target white balance gain of the pixel block, and then the white balance correction process of the pixel block can be performed using the target white balance gain.
在一些实施例中,基于像素块的场景类别信息对初始白平衡增益进行补偿,得到目标白平衡增益时,可以基于各像素块的场景类别信息确定补偿系数,然后利用该补偿系数对初始白平衡增益进行补偿,得到像素块对应的目标白平衡增益。比如,假设某个像素块的RGB值落入荧光灯下的白色物体的颜色区间内,由于位于该颜色区间内的物体,可能是白色物体,也可能是绿植,因而可以结合该像素块所属的目标场景类别,确定该像素块是不是绿植,进而基于其是否为绿植对初始白平衡增益进行调整,得到目标白平衡增益。其中,补偿系数可以基于实际情况设置,以便最终得到的目标白平衡增益更加准确,白平衡校正后的图像更加贴近真实色彩。In some embodiments, the initial white balance gain is compensated based on the scene category information of the pixel blocks. When the target white balance gain is obtained, the compensation coefficient can be determined based on the scene category information of each pixel block, and then the compensation coefficient can be used to correct the initial white balance gain. The gain is compensated to obtain the target white balance gain corresponding to the pixel block. For example, suppose the RGB value of a certain pixel block falls within the color interval of a white object under a fluorescent lamp. Since the object in this color interval may be a white object or a green plant, it can be combined with the The target scene category determines whether the pixel block is a green plant, and then adjusts the initial white balance gain based on whether it is a green plant to obtain the target white balance gain. Wherein, the compensation coefficient can be set based on the actual situation, so that the final target white balance gain is more accurate, and the image after white balance correction is closer to the real color.
在一些实施例中,补偿系数可以基于以下方式确定:可以先确定像素块中落入混淆色的颜色区间的第二指定区域的第三占比,比如,可以基于像素块中各区域的RGB值判定该区域是否落入混淆色的颜色区间,然后统计落入混淆色的颜色区间的所有像素区域在整个像素块中的第三占比。然后可以根据该第三占比、该像素块所属的目标物体类别、该像素块的亮度、待处理图像的前一帧图像对应的色温、待处理图像的前一帧图像对应的色调中的一个或多个确定补偿系数。In some embodiments, the compensation coefficient can be determined based on the following method: the third proportion of the second designated area falling into the color interval of the confused color in the pixel block can be determined first, for example, it can be based on the RGB values of each area in the pixel block Determine whether the area falls into the color interval of the confused color, and then calculate the third proportion of all pixel areas falling into the color interval of the confused color in the entire pixel block. Then one of the third ratio, the category of the target object to which the pixel block belongs, the brightness of the pixel block, the color temperature corresponding to the previous frame image of the image to be processed, and the hue corresponding to the previous frame image of the image to be processed or more to determine the compensation coefficient.
其中,在确定待处理图像中的初始白平衡增益时,可以采用传统的方 式确定,比如,可以直接基于图像的RGB值确定,当然,在一些实施例中,为了确定的初始白平衡增益可以更加准确,也可以结合待处理图像中各像素块的场景类别确定像素块中的白点的目标权重,然后基于白点的RGB值和目标权重确定待处理图像的初始白平衡增益,其中,确定像素块中白点的目标权重,以及基于白点的RGB值和目标权重确定待处理图像的初始白平衡增益的具体实现过程可以参考上述实施例中的描述,在此不再赘述。Wherein, when determining the initial white balance gain in the image to be processed, it can be determined in a traditional way, for example, it can be determined directly based on the RGB value of the image. Of course, in some embodiments, the initial white balance gain for determination can be more Accurately, it is also possible to determine the target weight of the white point in the pixel block in combination with the scene category of each pixel block in the image to be processed, and then determine the initial white balance gain of the image to be processed based on the RGB value of the white point and the target weight, wherein, determine the pixel For the target weight of the white point in the block, and the specific implementation process of determining the initial white balance gain of the image to be processed based on the RGB value of the white point and the target weight, reference may be made to the description in the foregoing embodiments, and details are not repeated here.
在一些实施例中,在根据像素块是否落入混淆色颜色区间对待处理图像进行补偿时,也可以针对室外场景和室内场景两种情况分两路处理。比如,场景类别信息可以包括待处理图像为室内场景的置信度,以及待处理图像为室外场景的置信度,补偿系数包括待处理图像为室内场景下的第一补偿系数,以及待处理图像为室外场景下的第二补偿系数。然后可以利用第一补偿系数对初始白平衡增益进行补偿,得到的第三白平衡增益,利用第二补偿系数对初始白平衡增益进行补偿,得到第四白平衡增益,进而可以基于待处理图像为室内场景的置信度以及待处理图像为室外场景的置信度,对第三白平衡增益和第四白平衡增益进行加权平均处理,得到目标白平衡增益。In some embodiments, when the image to be processed is compensated according to whether the pixel block falls into the mixed color range, it can also be processed in two ways for the outdoor scene and the indoor scene. For example, the scene category information may include the confidence that the image to be processed is an indoor scene, and the confidence that the image to be processed is an outdoor scene, and the compensation coefficient includes the first compensation coefficient when the image to be processed is an indoor scene, and the image to be processed is an outdoor scene. The second compensation coefficient in the scene. Then, the first compensation coefficient can be used to compensate the initial white balance gain, and the obtained third white balance gain can be compensated by the second compensation coefficient to obtain the fourth white balance gain, which can then be based on the image to be processed as The confidence of the indoor scene and the confidence that the image to be processed is an outdoor scene are weighted and averaged on the third white balance gain and the fourth white balance gain to obtain the target white balance gain.
比如,在得到初始白平衡增益后,针对室外场景和室内场景,其对初始白平衡进行补偿时的所用的补偿系数可以不一样,使其更符合室内场景或室外场景的特点,因而可以针对室内场景和室外场景分别确定不同的补偿系数,进而得到室内场景和室外场景下的白平衡增益,以便基于待处理图像为室内场景的置信度和室外场景的置信度综合两路计算结果得到最终的目标白平衡增益。For example, after obtaining the initial white balance gain, the compensation coefficient used to compensate the initial white balance can be different for outdoor scenes and indoor scenes, so that it is more in line with the characteristics of indoor scenes or outdoor scenes, so it can be used for indoor scenes. Different compensation coefficients are determined for the scene and the outdoor scene, and then the white balance gains for the indoor scene and the outdoor scene are obtained, so that the final target can be obtained based on the confidence of the image to be processed as the indoor scene and the confidence of the outdoor scene. White balance gain.
在一些实施例中,由于白平衡处理可以消除光源的影响,然而实际用户看到的场景,还是会受到光源的影响,比如,在黄色光源下,物体整体会偏黄色。为了让图像可以更加接近真实场景,在对待处理图像进行白平衡校正处理后,可以进一步对待处理图像进行氛围色处理,让图像的整体色调更加贴近实际色彩。In some embodiments, since the white balance processing can eliminate the influence of the light source, the actual scene seen by the user will still be affected by the light source. For example, under a yellow light source, the overall object will be yellowish. In order to make the image closer to the real scene, after performing white balance correction on the image to be processed, the image to be processed can be further processed with ambient color, so that the overall tone of the image is closer to the actual color.
不难理解,在不存在冲突的情况下,上述各个实施例中的方案可以自由组合,鉴于篇幅的原因,在此不再例举。It is not difficult to understand that, if there is no conflict, the solutions in the above embodiments can be combined freely, and due to space reasons, no more examples are given here.
为了进一步解释本申请实施例中的图像处理方法,以下结合图2,以一个具体的实施例加以解释。In order to further explain the image processing method in the embodiment of the present application, a specific embodiment is explained below in conjunction with FIG. 2 .
在对图像进行白平衡处理时,如果仅基于图像的RGB值确定白点,进而确定白平衡增益,得到的白平衡增益往往不够准确,导致白平衡处理后的图像效果较差。为了解决上述问题,本实施例提供了一种图像处理方法,具体包括以下步骤:When performing white balance processing on an image, if the white point is determined only based on the RGB value of the image, and then the white balance gain is determined, the obtained white balance gain is often not accurate enough, resulting in a poor image effect after white balance processing. In order to solve the above problems, this embodiment provides an image processing method, which specifically includes the following steps:
1、确定待处理图像中的各像素块属于预设多个场景类别中的每个场景类别的目标置信度。1. Determine the target confidence level that each pixel block in the image to be processed belongs to each scene category among a plurality of preset scene categories.
首先,可以预先设置多个场景类别(比如,A类别、B类别、C类别等),该多个场景类别的设置原则如下:First, multiple scene categories (for example, category A, category B, category C, etc.) can be set in advance, and the principles for setting the multiple category categories are as follows:
(1)可用于确定待处理图像为室内场景或室外场景,比如,可以是天空(可以确定是室外场景),地板(可以确定是室内场景)。(1) It can be used to determine whether the image to be processed is an indoor scene or an outdoor scene, for example, it can be the sky (it can be determined to be an outdoor scene), and the floor (it can be determined to be an indoor scene).
(2)可用于确定待处理图像中的白点。(2) can be used to determine the white point in the image to be processed.
(3)该场景类别包含的场景的颜色区间与至少一种除该场景以外的其他场景的颜色区间存在重叠区域,比如,黄色物体和黄色光源下的白色物体、绿植和荧光下的白色物体等(3) The color range of the scene included in the scene category overlaps with the color range of at least one scene other than this scene, for example, yellow objects and white objects under yellow light sources, green plants and white objects under fluorescent light wait
然后可以通过预先训练的神经网络确定图像中的各像素块属于该多个场景类别中的每个场景类别的初始置信度。由于直接通过神经网络确定的初始置信度不够准确,因而可以结合像素块的亮度信息,像素块中落入每个场景类别对应的颜色区间的区域的占比Q1对初始置信度进行调整,得到各像素块属于每个场景类别的目标置信度。其中,像素块中的亮度信息与该预先标定的该场景类别的亮度越接近,则目标置信度越大。该占比Q1越大,说明像素块属于该场景类别的可能性越大,则目标置信度越大。Then, the initial confidence that each pixel block in the image belongs to each scene category among the plurality of scene categories can be determined through a pre-trained neural network. Since the initial confidence determined directly through the neural network is not accurate enough, the initial confidence can be adjusted by combining the brightness information of the pixel block and the proportion Q1 of the area in the pixel block falling into the color range corresponding to each scene category, and obtaining each The object confidence that the pixel block belongs to each scene category. Wherein, the closer the luminance information in the pixel block is to the pre-marked luminance of the scene category, the greater the target confidence. The larger the ratio Q1 is, the greater the possibility is that the pixel block belongs to the scene category, and the greater the target confidence is.
2、确定待处理图像中属于该多个场景类别中的每个场景类别的区域的占比。2. Determine the proportion of the area belonging to each scene category in the plurality of scene categories in the image to be processed.
针对每个像素块,可以将目标置信度最高的场景类别作为该像素块对应的场景类别,然后可以统计属于每个场景类别的所有像素块的面积与待处理图像的面积的占比,得到每个场景类别在待处理图像的占比Q2,其中,由于单帧图像确定的占比Q2可能不太准确,因而可以结合待处理图像前后的多帧图像的占比Q2,对该占比Q2进行滤波处理(比如,取平均或加权平均),得到最终的占比Q3。For each pixel block, the scene category with the highest target confidence can be used as the scene category corresponding to the pixel block, and then the ratio of the area of all pixel blocks belonging to each scene category to the area of the image to be processed can be calculated, and each The proportion Q2 of a scene category in the image to be processed, wherein, since the proportion Q2 determined by a single frame image may not be accurate, it can be combined with the proportion Q2 of the multi-frame images before and after the image to be processed, and the proportion Q2 can be calculated. Filtering processing (for example, averaging or weighted averaging) to obtain the final proportion Q3.
3、确定待处理图像为室内场景和室外场景的置信度。3. Determine the confidence that the image to be processed is an indoor scene or an outdoor scene.
根据待处理图像中每个场景类别的占比Q3,以及该场景类别对应于室内场景的权重,得到待处理图像为室内场景的置信度。根据待处理图像中每个场景类别的占比Q3,以及该场景类别对应于室外场景的权重,得到待处理图像为室外场景的置信度。According to the proportion Q3 of each scene category in the image to be processed, and the weight of the scene category corresponding to the indoor scene, the confidence that the image to be processed is an indoor scene is obtained. According to the proportion Q3 of each scene category in the image to be processed, and the weight of the scene category corresponding to the outdoor scene, the confidence that the image to be processed is an outdoor scene is obtained.
其中,每个场景类别对应于室外场景的权重、以及每个场景类别对应于室内场景的权重可以基于待处理图像中属于每个场景类别的像素区域的亮度、以及场景类别的类型(比如,天空对应于室外场景的权重会高一些、地板对应于室内场景的权重会高一些)确定。Wherein, each scene category corresponds to the weight of the outdoor scene, and each scene category corresponds to the weight of the indoor scene can be based on the brightness of the pixel area belonging to each scene category in the image to be processed, and the type of the scene category (for example, sky The weight corresponding to the outdoor scene will be higher, and the weight of the floor corresponding to the indoor scene will be higher) to determine.
4、白平衡增益的确定4. Determination of white balance gain
可以基于待处理图像的像素点的RGB值确定待处理图像中的白点,针对每个像素块中的白点,可以根据像素块所属的场景类别对像素块中的白点的权重进行调整,得到目标权重,比如,对于天空、绿植、泥土等类别的白点,可以降低该白点的权重,而对于可能是白点的场景类别,比如,室外马路,可以提升该白点的权重,从而更精确的实现找白。在确定各白点的目标权重后,可以基于目标权重和各白点的RGB值确定白平衡增益。The white point in the image to be processed can be determined based on the RGB values of the pixels of the image to be processed, and for the white point in each pixel block, the weight of the white point in the pixel block can be adjusted according to the scene category to which the pixel block belongs, Get the target weight, for example, for the white point of the sky, green plants, soil and other categories, you can reduce the weight of the white point, and for the scene category that may be a white point, such as outdoor roads, you can increase the weight of the white point, In order to achieve more accurate white finding. After determining the target weight of each white point, the white balance gain can be determined based on the target weight and the RGB value of each white point.
此外,针对待处理图像为室内场景和室外场景两种情况,白点对应的目标权重,也可以不一样,因而,可以分两路处理,确定室内场景下的白平衡增益1,以及室外场景下的白平衡增益2。In addition, for the two cases where the image to be processed is an indoor scene and an outdoor scene, the target weight corresponding to the white point may also be different. Therefore, it can be processed in two ways to determine the white balance gain of 1 in the indoor scene and the white balance gain in the outdoor scene. The white balance gain is 2.
5、混淆色处理5. Confused color processing
由于有些场景的颜色区间较为接近,存在混淆的问题。比如,黄色物 体与黄色灯光下的白色物体、蓝色物体与蓝色灯光下的白色物体、绿植与荧光光源下的白色物体、雪景与蓝天等场景,由于其颜色区间很接近,容易混淆无法确定该像素区域真实的场景类别,进而导致确定的白平衡增益不准确。所以,在确定白平衡后,可以进一步基于各像素块所属的场景类别判定各像素块的RGB值是否落入混淆色的颜色区间,即判定各像素块是否可能出现混淆,进而对确定的白平衡增益进行补偿。Because the color intervals of some scenes are relatively close, there is a problem of confusion. For example, scenes such as yellow objects and white objects under yellow light, blue objects and white objects under blue light, green plants and white objects under fluorescent light sources, snow scenes and blue sky are easy to confuse because their color ranges are very close. Determining the true scene category of the pixel area, which in turn results in an inaccurate determination of the white balance gain. Therefore, after determining the white balance, it is possible to further determine whether the RGB values of each pixel block fall into the color interval of the confusion color based on the scene category to which each pixel block belongs, that is, to determine whether each pixel block may be confused, and then to determine the white balance Gain is compensated.
比如,可以计算像素块中RGB值落入混淆色的颜色区间的区域的占比Q4,根据占比Q4的大小、像素块所属的场景类别、环境亮度、待处理图像上一帧图像对应的色温和色调等确定补偿系数,进而对上一步确定的白平衡增益进行补偿。For example, it is possible to calculate the proportion Q4 of the area where the RGB value of the pixel block falls into the color interval of the confused color, according to the size of the proportion Q4, the scene category to which the pixel block belongs, the ambient brightness, and the color corresponding to the previous frame of the image to be processed The compensation coefficient is determined based on the mild tone, etc., and then the white balance gain determined in the previous step is compensated.
其中,在对白平衡增益进行补偿时,也可以分室内和室外两路处理,针对室内场景和室外场景,分别确定不同的补偿系数b1和b2,然后利用b1对上一步确定室内场景下的白平衡增益1进行补偿,得到白平衡增益3,然后利用b2对上一步确定室内场景下的白平衡增益2进行补偿,得到白平衡增益4。Among them, when compensating the white balance gain, it can also be divided into indoor and outdoor two-way processing. For indoor scenes and outdoor scenes, different compensation coefficients b1 and b2 are determined respectively, and then use b1 to determine the white balance in the indoor scene Compensate with gain 1 to obtain white balance gain 3, and then use b2 to compensate white balance gain 2 in the indoor scene determined in the previous step to obtain white balance gain 4.
6、融合室内场景和室外场景两路处理结果。6. Integrate the two-way processing results of indoor scenes and outdoor scenes.
根据步骤3确定待处理图像为室内场景的置信度,以及待处理图像为室外场景的置信度对白平衡增益3,和白平衡增益4进行加权处理,得到最终的目标白平衡增益,用于对待处理图像进行校正。According to step 3, it is determined that the image to be processed is the confidence degree of the indoor scene, and the confidence degree of the image to be processed is the outdoor scene, and the white balance gain 3 and the white balance gain 4 are weighted to obtain the final target white balance gain, which is used for the image to be processed. The image is corrected.
7、氛围色处理7. Atmosphere color processing
在对图像进行白平衡处理后,可以进一步结合光源的颜色对图像进行氛围色调整,得到目标图像,使得目标图像的色彩更加符合实际场景。After the white balance processing is performed on the image, the ambient color of the image can be further adjusted in combination with the color of the light source to obtain the target image, so that the color of the target image is more in line with the actual scene.
通过本实施例提供的方法,在进行白平衡处理时,可以实现精准“找白”,的到准确的白平衡增益,同时,也可以消除一些颜色区间会混淆的场景对白平衡的影响,得到更加准确的白平衡处理效果。Through the method provided in this embodiment, when performing white balance processing, accurate "white finding" can be achieved, and accurate white balance gains can be obtained. At the same time, the influence of some scenes where the color intervals will be confused on the white balance can be eliminated, and a more accurate white balance can be obtained. Accurate white balance processing effect.
与上述方法相对应,本申请实施例还提供了一种图像处理装置,如图3所示,所述装置30包括处理器31、存储器32、存储于所述存储器32可 供所述处理器31执行的计算机程序,所述处理器31执行所述计算机程序时,可实现以下步骤:Corresponding to the above method, the embodiment of the present application also provides an image processing device. As shown in FIG. Executing computer program, when the processor 31 executes the computer program, the following steps can be realized:
获取待处理图像;Get the image to be processed;
确定所述待处理图像中的像素块的场景类别信息;determining scene category information of pixel blocks in the image to be processed;
基于所述像素块的场景类别信息确定目标白平衡增益,以利用所述目标白平衡增益对所述待处理图像进行白平衡校正。Determine a target white balance gain based on the scene category information of the pixel block, so as to perform white balance correction on the image to be processed by using the target white balance gain.
在一些实施例中,所述场景类别信息包括:所述像素块所属的目标物体类别和/或指示所述待处理图像为室内场景或室外场景的信息。In some embodiments, the scene category information includes: a target object category to which the pixel block belongs and/or information indicating that the image to be processed is an indoor scene or an outdoor scene.
在一些实施例中,其中,所述目标物体类别为预设的多个物体类别中的一个,所述预设的多个物体类别中的每个物体类别具有至少以下一种特性:In some embodiments, wherein the target object category is one of a plurality of preset object categories, each object category in the preset plurality of object categories has at least one of the following characteristics:
所述每个物体类别可用于确定所述待处理图像为室内场景或室外场景;Each object category can be used to determine that the image to be processed is an indoor scene or an outdoor scene;
所述每个物体类别可用于确定所述待处理图像中的白点;Each of the object categories can be used to determine the white point in the image to be processed;
所述每个物体类别包含的场景的颜色区间与至少一种除所述场景以外的其他场景的颜色区间存在重叠区域。The color interval of the scene included in each object category overlaps with the color interval of at least one scene other than the scene.
在一些实施例中,所述像素块所属的目标物体类别基于以下方式确定:In some embodiments, the category of the target object to which the pixel block belongs is determined based on the following manner:
分别确定所述像素块为预设的多个物体类别中的每个物体类别的目标置信度;Respectively determining that the pixel block is a target confidence degree of each object category in a plurality of preset object categories;
基于所述目标置信度从所述多个物体类别中确定所述像素块所属的目标物体类别。Determine the target object category to which the pixel block belongs from the plurality of object categories based on the target confidence.
在一些实施例中,所述基于所述目标置信度从所述多个物体类别中确定所述像素块所属的目标物体类别,包括:In some embodiments, the determining the target object category to which the pixel block belongs from the plurality of object categories based on the target confidence degree includes:
将所述目标置信度最大的物体类别作为所述像素块所属的目标物体类别。The object category with the highest target confidence is taken as the target object category to which the pixel block belongs.
在一些实施例中,分别确定所述像素块为多个物体类别中的每个物体类别的目标置信度,包括:In some embodiments, determining that the pixel block is a target confidence degree of each object category in a plurality of object categories includes:
针对每个物体类别,基于预先训练的神经网络确定所述像素块为所述 物体类别的初始置信度;For each object category, determine the initial confidence that the pixel block is the object category based on the pre-trained neural network;
将所述初始置信度作为所述目标置信度;或using said initial confidence as said target confidence; or
针对每个物体类别,基于预先训练的神经网络确定所述像素块为所述物体类别的初始置信度;For each object category, determine the initial confidence that the pixel block is the object category based on a pre-trained neural network;
基于所述像素块的像素值相关信息对所述初始置信度进行调整,得到所述目标置信度。The initial confidence is adjusted based on the pixel value related information of the pixel block to obtain the target confidence.
在一些实施例中,所述像素值相关信息包括以下一种或多种:In some embodiments, the pixel value-related information includes one or more of the following:
所述像素块的亮度、以及所述像素块中第一指定像素区域的第一占比,其中,所述第一指定像素区域的RGB值落入所述场景类别对应的颜色区间内。The brightness of the pixel block and the first proportion of the first specified pixel area in the pixel block, wherein the RGB value of the first specified pixel area falls within the color range corresponding to the scene category.
在一些实施例中,所述目标置信度正相关于所述第一占比,所述目标置信度正相关于所述像素块的亮度与所述物体类别的标定亮度的接近程度。In some embodiments, the target confidence level is positively related to the first proportion, and the target confidence level is positively related to the closeness of the luminance of the pixel block to the nominal luminance of the object category.
在一些实施例中,在所述像素块的亮度小于预设亮度阈值的情况下,所述目标置信度为0。In some embodiments, when the brightness of the pixel block is less than a preset brightness threshold, the target confidence level is 0.
在一些实施例中,指示所述待处理图像为室内场景或室外场景的信息包括:In some embodiments, the information indicating that the image to be processed is an indoor scene or an outdoor scene includes:
所述待处理图像为室内场景的置信度、和/或所述待处理图像为室外场景的置信度。The confidence level that the image to be processed is an indoor scene, and/or the confidence level that the image to be processed is an outdoor scene.
在一些实施例中,所述待处理图像为室内场景的置信度或室外场景的置信度基于以下方式确定:In some embodiments, the confidence that the image to be processed is an indoor scene or the confidence of an outdoor scene is determined based on the following manner:
基于所述待处理图像中各像素块所属的目标物体类别确定属于各个目标物体类别的所有像素块在所述待处理图像中的第二占比;determining a second proportion of all pixel blocks belonging to each target object category in the image to be processed based on the target object category to which each pixel block in the image to be processed belongs;
基于所述第二占比、以及各个目标物体类别对于室内场景的权重确定所述待处理图像为室内场景的置信度;或Determine the confidence that the image to be processed is an indoor scene based on the second proportion and the weight of each target object category for the indoor scene; or
基于所述第二占比、以及各个目标物体类别对于室外场景的权重确定所述待处理图像为室外场景的置信度。Determine the confidence that the image to be processed is an outdoor scene based on the second ratio and the weights of each target object category for the outdoor scene.
在一些实施例中,各个目标物体类别对于室内场景的权重或各个目标 物体类别对于室内场景的权重基于以下一种或多种确定:属于各个目标物体类别的所有像素块的亮度、以及各个目标物体类别的类型。In some embodiments, the weight of each target object category for the indoor scene or the weight of each target object category for the indoor scene is determined based on one or more of the following: the brightness of all pixel blocks belonging to each target object category, and the The type of category.
在一些实施例中,所述第二占比基于以下方式确定:In some embodiments, the second ratio is determined based on the following methods:
获取在所处待处理图像之前和/或之后采集的多帧目标图像;Acquiring multiple frames of target images collected before and/or after the image to be processed;
对所述多帧目标图像中属于各个目标物体类别的所有像素块的占比,以及所述待处理图像中属于各个目标物体类别的像素块的占比进行滤波处理,得到所述第二占比。performing filtering processing on the proportions of all pixel blocks belonging to each target object category in the multi-frame target image and the proportions of pixel blocks belonging to each target object category in the image to be processed, to obtain the second proportion .
在一些实施例中,所述处理器用于基于所述像素块的场景类别信息确定目标白平衡增益时,具体用于:In some embodiments, when the processor is configured to determine the target white balance gain based on the scene category information of the pixel block, it is specifically configured to:
基于所述像素块的所属的目标物体类别确定所述像素块中的白点的目标权重;determining the target weight of the white point in the pixel block based on the category of the target object to which the pixel block belongs;
基于所述白点的RGB值和所述目标权重确定所述目标白平衡增益。The target white balance gain is determined based on the RGB value of the white point and the target weight.
在一些实施例中,所述场景类别信息包括所述像素块所属的目标物体类别,所述目标物体类别不同时,所述目标权重不同;和/或In some embodiments, the scene category information includes the target object category to which the pixel block belongs, and when the target object categories are different, the target weights are different; and/or
所述场景类别信息包括指示所述待处理图像为室内场景或室外场景的信息,所述待处理图像为室内场景下的所述目标权重,不同于所述待处理图像为室外场景时的所述目标权重。The scene category information includes information indicating that the image to be processed is an indoor scene or an outdoor scene, and the target weight of the image to be processed is an indoor scene, which is different from the target weight when the image to be processed is an outdoor scene. target weight.
在一些实施例中,所述处理器用于基于所述像素块的场景类别信息确定所述像素块中的白点的目标权重时,具体用于:In some embodiments, when the processor is configured to determine the target weight of the white point in the pixel block based on the scene category information of the pixel block, it is specifically configured to:
确定所述像素块中的白点的初始权重;determining initial weights for white points in the pixel block;
基于所述像素块的场景类别信息对所述初始权重进行调整,得到所述像素块中的白点的目标权重。The initial weight is adjusted based on the scene category information of the pixel block to obtain the target weight of the white point in the pixel block.
在一些实施例中,所述初始权重基于以下至少一种或多种确定:所述像素块的亮度、以及所述像素块对应的色温确定,其中,所述像素块对应的色温基于所述像素块的RGB值确定。In some embodiments, the initial weight is determined based on at least one or more of the following: the brightness of the pixel block, and the color temperature corresponding to the pixel block, wherein the color temperature corresponding to the pixel block is determined based on the pixel The RGB value of the block is determined.
在一些实施例中,所处场景类别信息包括:所述待处理图像为室内场景的置信度、和/或所述待处理图像为室外场景的置信度,所述处理器用于 基于所述像素块的场景类别信息确定目标白平衡增益时,具体用于:In some embodiments, the scene category information includes: the confidence level that the image to be processed is an indoor scene, and/or the confidence level that the image to be processed is an outdoor scene, and the processor is configured to When determining the target white balance gain based on scene category information, it is specifically used for:
确定所述待处理图像为室外场景时,所述像素块中的白点的第一目标权重,基于所述白点的RGB值和所述第一目标权重确定第一白平衡增益;When it is determined that the image to be processed is an outdoor scene, the first target weight of the white point in the pixel block is determined based on the RGB value of the white point and the first target weight to determine a first white balance gain;
确定所述待处理图像为室内场景时,所述像素块中的白点的第二目标权重,基于所述白点的RGB值和所述第二目标权重确定第二白平衡增益;When it is determined that the image to be processed is an indoor scene, the second target weight of the white point in the pixel block is determined based on the RGB value of the white point and the second target weight to determine a second white balance gain;
基于所述待处理图像为室内场景的置信度、所述待处理图像为室外场景的置信度,对所述第一白平衡增益和所述第二白平衡增益进行加权处理得到所述目标白平衡增益。Based on the confidence that the image to be processed is an indoor scene and the confidence that the image to be processed is an outdoor scene, perform weighting processing on the first white balance gain and the second white balance gain to obtain the target white balance gain.
在一些实施例中,所述处理器用于基于所述像素块的场景类别信息确定目标白平衡增益时,具体用于:In some embodiments, when the processor is configured to determine the target white balance gain based on the scene category information of the pixel block, it is specifically configured to:
确定所述待处理图像的初始白平衡增益;determining the initial white balance gain of the image to be processed;
针对每个所述像素块,在确定所述像素块的RGB值落入混淆色的颜色区间的情况下,基于所述像素块的场景类别信息对所述像素块的所述初始白平衡增益进行补偿,得到所述像素块的目标白平衡增益。For each pixel block, when it is determined that the RGB value of the pixel block falls into the color interval of the confused color, the initial white balance gain of the pixel block is calculated based on the scene category information of the pixel block. compensation to obtain the target white balance gain of the pixel block.
在一些实施例中,所述处理器用于基于所述像素块的场景类别信息对所述初始白平衡增益进行补偿,得到目标白平衡增益时,具体用于:In some embodiments, the processor is configured to compensate the initial white balance gain based on the scene category information of the pixel block, and when the target white balance gain is obtained, it is specifically used for:
基于所述像素块的场景类别信息确定补偿系数;determining a compensation coefficient based on the scene category information of the pixel block;
利用所述补偿系数对所述初始白平衡增益进行补偿,得到所述目标白平衡增益。The compensation coefficient is used to compensate the initial white balance gain to obtain the target white balance gain.
在一些实施例中,所述场景类别信息包括所述像素块所属的目标物体类别,所述补偿系数基于以下方式确定:In some embodiments, the scene category information includes the target object category to which the pixel block belongs, and the compensation coefficient is determined based on the following method:
确定所述像素块中的第二指定区域的第三占比,其中,所述第二指定区域为所述像素块中RGB值落入混淆色的颜色区间;Determine the third proportion of the second specified area in the pixel block, wherein the second specified area is a color interval in which the RGB value of the pixel block falls into the confused color;
基于所述第三占比、所述像素块所属的目标场景类别、所述像素块的亮度、所述待处理图像的前一帧图像对应的色温、所述待处理图像的前一帧图像对应的色调中的一个或多个确定所述补偿系数。Based on the third ratio, the category of the target scene to which the pixel block belongs, the brightness of the pixel block, the color temperature corresponding to the previous frame of the image to be processed, and the corresponding color temperature of the previous frame of the image to be processed One or more of the hues determine the compensation coefficients.
在一些实施例中,所述处理器用于确定所述待处理图像的初始白平衡 增益时,具体用于:In some embodiments, when the processor is used to determine the initial white balance gain of the image to be processed, it is specifically used for:
基于所述像素块的所属的目标物体类别确定所述像素块中的白点的目标权重;determining the target weight of the white point in the pixel block based on the category of the target object to which the pixel block belongs;
基于所述白点的RGB值和所述目标权重确定所述待处理图像的初始白平衡增益。An initial white balance gain of the image to be processed is determined based on the RGB value of the white point and the target weight.
在一些实施例中,所述场景类别信息包括所述待处理图像为室内场景的置信度,以及所述待处理图像为室外场景的置信度,所述补偿系数包括所述待处理图像为室内场景下的第一补偿系数,以及所述待处理图像为室外场景下的第二补偿系数;In some embodiments, the scene category information includes the confidence that the image to be processed is an indoor scene, and the confidence that the image to be processed is an outdoor scene, and the compensation coefficient includes that the image to be processed is an indoor scene The first compensation coefficient under, and the image to be processed is the second compensation coefficient under an outdoor scene;
利用所述第一补偿系数对所述初始白平衡增益进行补偿,得到的第三白平衡增益;Compensating the initial white balance gain by using the first compensation coefficient to obtain a third white balance gain;
利用所述第二补偿系数对所述初始白平衡增益进行补偿,得到第四白平衡增益;Compensating the initial white balance gain by using the second compensation coefficient to obtain a fourth white balance gain;
基于所述待处理图像为室内场景的置信度以及所述待处理图像为室外场景的置信度,对所述第三白平衡增益和所述第四白平衡增益进行加权平均处理,得到所述目标白平衡增益。Based on the confidence that the image to be processed is an indoor scene and the confidence that the image to be processed is an outdoor scene, perform weighted average processing on the third white balance gain and the fourth white balance gain to obtain the target White balance gain.
在一些实施例中,所述处理器还用于:In some embodiments, the processor is further configured to:
对白平衡校正处理后的所述待处理图像进行氛围色处理。Ambient color processing is performed on the image to be processed after white balance correction processing.
进一步地,本申请实施例中还提供了一种图像采集设备,该图像采集包括如上述实施例中任一项所述的图像处理装置。该图像采集设备可以手持云台相机、手机、无人机等各种设备。Further, an image acquisition device is also provided in an embodiment of the present application, and the image acquisition includes the image processing apparatus as described in any one of the above embodiments. The image acquisition device can hold various devices such as pan-tilt cameras, mobile phones, and drones.
相应地,本说明书实施例还提供一种计算机存储介质,所述存储介质中存储有程序,所述程序被处理器执行时实现上述任一实施例中的方法。Correspondingly, the embodiments of this specification further provide a computer storage medium, where a program is stored in the storage medium, and when the program is executed by a processor, the method in any of the foregoing embodiments is implemented.
本说明书实施例可采用在一个或多个其中包含有程序代码的存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。计算机可用存储介质包括永久性和非永久性、可移动和非可移动媒体,可以由任何方法或技术来实现信息存储。信息可以是计算机可读 指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括但不限于:相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。Embodiments of the present description may take the form of a computer program product embodied on one or more storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) having program code embodied therein. Computer usable storage media includes both volatile and non-permanent, removable and non-removable media, and may be implemented by any method or technology for information storage. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for computers include, but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it basically corresponds to the method embodiment, for related parts, please refer to the part description of the method embodiment. The device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without creative effort.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or order between them. The term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements but also other elements not expressly listed elements, or also elements inherent in such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
以上对本发明实施例所提供的方法和装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变 之处,综上所述,本说明书内容不应理解为对本发明的限制。The methods and devices provided by the embodiments of the present invention have been described in detail above. The principles and implementation methods of the present invention have been explained by using specific examples in this paper. The descriptions of the above embodiments are only used to help understand the methods and methods of the present invention. core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary, the content of this specification should not be construed as limiting the present invention .

Claims (50)

  1. 一种图像处理方法,其特征在于,所述方法包括:An image processing method, characterized in that the method comprises:
    获取待处理图像;Get the image to be processed;
    确定所述待处理图像中的像素块的场景类别信息;determining scene category information of pixel blocks in the image to be processed;
    基于所述像素块的场景类别信息确定目标白平衡增益,以利用所述目标白平衡增益对所述待处理图像进行白平衡校正。Determine a target white balance gain based on the scene category information of the pixel block, so as to perform white balance correction on the image to be processed by using the target white balance gain.
  2. 根据权利要求1所述的方法,其特征在于,所述场景类别信息包括:所述像素块所属的目标物体类别和/或指示所述待处理图像为室内场景或室外场景的信息。The method according to claim 1, wherein the scene category information includes: the target object category to which the pixel block belongs and/or information indicating that the image to be processed is an indoor scene or an outdoor scene.
  3. 根据权利要求2所述的方法,其特征在于,其中,所述目标物体类别为预设的多个物体类别中的一个,所述预设的多个物体类别中的每个物体类别具有至少以下一种特性:The method according to claim 2, wherein the target object category is one of a plurality of preset object categories, and each object category in the preset plurality of object categories has at least the following A characteristic:
    所述每个物体类别可用于确定所述待处理图像为室内场景或室外场景;Each object category can be used to determine that the image to be processed is an indoor scene or an outdoor scene;
    所述每个物体类别可用于确定所述待处理图像中的白点;Each of the object categories can be used to determine the white point in the image to be processed;
    所述每个物体类别包含的场景的颜色区间与至少一种除所述场景以外的其他场景的颜色区间存在重叠区域。The color interval of the scene included in each object category overlaps with the color interval of at least one scene other than the scene.
  4. 根据权利要求2或3所述的方法,其特征在于,所述像素块所属的目标物体类别基于以下方式确定:The method according to claim 2 or 3, wherein the category of the target object to which the pixel block belongs is determined based on the following method:
    分别确定所述像素块为预设的多个物体类别中的每个物体类别的目标置信度;Respectively determining that the pixel block is a target confidence degree of each object category in a plurality of preset object categories;
    基于所述目标置信度从所述多个物体类别中确定所述像素块所属的目标物体类别。Determine the target object category to which the pixel block belongs from the plurality of object categories based on the target confidence.
  5. 根据权利要求4所述的方法,其特征在于,基于所述目标置信度从所述多个物体类别中确定所述像素块所属的目标物体类别,包括:The method according to claim 4, wherein determining the target object category to which the pixel block belongs from the plurality of object categories based on the target confidence degree comprises:
    将所述目标置信度最大的物体类别作为所述像素块所属的目标物体类别。The object category with the highest target confidence is taken as the target object category to which the pixel block belongs.
  6. 根据权利要求4或5所述的方法,其特征在于,分别确定所述像素 块为多个物体类别中的每个物体类别的目标置信度,包括:The method according to claim 4 or 5, wherein determining the pixel block is respectively the target confidence level of each object category in a plurality of object categories, comprising:
    针对每个物体类别,基于预先训练的神经网络确定所述像素块为所述物体类别的初始置信度;For each object category, determine the initial confidence that the pixel block is the object category based on a pre-trained neural network;
    将所述初始置信度作为所述目标置信度;或using said initial confidence as said target confidence; or
    针对每个物体类别,基于预先训练的神经网络确定所述像素块为所述物体类别的初始置信度;For each object category, determine the initial confidence that the pixel block is the object category based on a pre-trained neural network;
    基于所述像素块的像素值相关信息对所述初始置信度进行调整,得到所述目标置信度。The initial confidence is adjusted based on the pixel value related information of the pixel block to obtain the target confidence.
  7. 根据权利要求6所述的方法,其特征在于,所述像素值相关信息包括以下一种或多种:The method according to claim 6, wherein the pixel value-related information includes one or more of the following:
    所述像素块的亮度、以及所述像素块中第一指定像素区域的第一占比,其中,所述第一指定像素区域的RGB值落入所述物体类别对应的颜色区间内。The brightness of the pixel block and the first proportion of the first specified pixel area in the pixel block, wherein the RGB value of the first specified pixel area falls within the color interval corresponding to the object category.
  8. 根据权利要求7所述的方法,其特征在于,所述目标置信度正相关于所述第一占比,所述目标置信度正相关于所述像素块的亮度与所述物体类别的标定亮度的接近程度。The method according to claim 7, wherein the target confidence is positively related to the first proportion, and the target confidence is positively related to the brightness of the pixel block and the calibrated brightness of the object category the degree of proximity.
  9. 根据权利要求7所述的方法,其特征在于,在所述像素块的亮度小于预设亮度阈值的情况下,所述目标置信度为0。The method according to claim 7, wherein when the brightness of the pixel block is less than a preset brightness threshold, the target confidence level is 0.
  10. 根据权利要求2-9任一项所述的方法,其特征在于,指示所述待处理图像为室内场景或室外场景的信息包括:The method according to any one of claims 2-9, wherein the information indicating that the image to be processed is an indoor scene or an outdoor scene includes:
    所述待处理图像为室内场景的置信度、和/或所述待处理图像为室外场景的置信度。The confidence level that the image to be processed is an indoor scene, and/or the confidence level that the image to be processed is an outdoor scene.
  11. 根据权利要求10所述的方法,其特征在于,所述待处理图像为室内场景的置信度或室外场景的置信度基于以下方式确定:The method according to claim 10, wherein the confidence that the image to be processed is an indoor scene or the confidence of an outdoor scene is determined based on the following manner:
    基于所述待处理图像中各像素块所属的目标物体类别确定属于各个目标物体类别的所有像素块在所述待处理图像中的第二占比;determining a second proportion of all pixel blocks belonging to each target object category in the image to be processed based on the target object category to which each pixel block in the image to be processed belongs;
    基于所述第二占比、以及各个目标物体类别对于室内场景的权重确定 所述待处理图像为室内场景的置信度;或Determine the confidence that the image to be processed is an indoor scene based on the second proportion and the weight of each target object category for the indoor scene; or
    基于所述第二占比、以及各个目标物体类别对于室外场景的权重确定所述待处理图像为室外场景的置信度。Determine the confidence that the image to be processed is an outdoor scene based on the second ratio and the weights of each target object category for the outdoor scene.
  12. 根据权利要求11所述的方法,其特征在于,各个目标物体类别对于室内场景的权重或各个目标物体类别对于室内场景的权重基于以下一种或多种确定:属于各个目标物体类别的所有像素块的亮度、以及各个目标物体类别的类型。The method according to claim 11, wherein the weight of each target object category for the indoor scene or the weight of each target object category for the indoor scene is determined based on one or more of the following: all pixel blocks belonging to each target object category brightness, and the type of each target object category.
  13. 根据权利要求11或12所述的方法,其特征在于,所述第二占比基于以下方式确定:The method according to claim 11 or 12, wherein the second proportion is determined based on the following method:
    获取在所处待处理图像之前和/或之后采集的多帧目标图像;Acquiring multiple frames of target images collected before and/or after the image to be processed;
    对所述多帧目标图像中属于各个目标物体类别的所有像素块的占比,以及所述待处理图像中属于各个目标物体类别的像素块的占比进行滤波处理,得到所述第二占比。performing filtering processing on the proportions of all pixel blocks belonging to each target object category in the multi-frame target image and the proportions of pixel blocks belonging to each target object category in the image to be processed, to obtain the second proportion .
  14. 根据权利要求1-13任一项所述的方法,其特征在于,基于所述像素块的场景类别信息确定目标白平衡增益,包括:The method according to any one of claims 1-13, wherein determining the target white balance gain based on the scene category information of the pixel block includes:
    基于所述像素块的场景类别信息确定所述像素块中的白点的目标权重;determining the target weight of the white point in the pixel block based on the scene category information of the pixel block;
    基于所述白点的RGB值和所述目标权重确定所述目标白平衡增益。The target white balance gain is determined based on the RGB value of the white point and the target weight.
  15. 根据权利要求14所述的方法,其特征在于,所述场景类别信息包括所述像素块所属的目标物体类别,所述目标物体类别不同时,所述目标权重不同;和/或The method according to claim 14, wherein the scene category information includes the target object category to which the pixel block belongs, and when the target object category is different, the target weight is different; and/or
    所述场景类别信息包括指示所述待处理图像为室内场景或室外场景的信息,所述待处理图像为室内场景下的所述目标权重,不同于所述待处理图像为室外场景时的所述目标权重。The scene category information includes information indicating that the image to be processed is an indoor scene or an outdoor scene, and the target weight of the image to be processed is an indoor scene, which is different from the target weight when the image to be processed is an outdoor scene. target weight.
  16. 根据权利要求14或15所述的方法,其特征在于,基于所述像素块的场景类别信息确定所述像素块中的白点的目标权重,包括:The method according to claim 14 or 15, wherein determining the target weight of the white point in the pixel block based on the scene category information of the pixel block comprises:
    确定所述像素块中的白点的初始权重;determining initial weights for white points in the pixel block;
    基于所述像素块的场景类别信息对所述初始权重进行调整,得到所述 像素块中的白点的目标权重。The initial weight is adjusted based on the scene category information of the pixel block to obtain the target weight of the white point in the pixel block.
  17. 根据权利要求16所述的方法,其特征在于,所述初始权重基于以下至少一种或多种确定:所述像素块的亮度、以及所述像素块对应的色温确定,其中,所述像素块对应的色温基于所述像素块的RGB值确定。The method according to claim 16, wherein the initial weight is determined based on at least one or more of the following: the brightness of the pixel block, and the color temperature corresponding to the pixel block, wherein the pixel block The corresponding color temperature is determined based on the RGB values of the pixel block.
  18. 根据权利要求13-17任一项所述的方法,其特征在于,所处场景类别信息包括:所述待处理图像为室内场景的置信度、和/或所述待处理图像为室外场景的置信度,基于所述像素块的场景类别信息确定目标白平衡增益,包括:The method according to any one of claims 13-17, wherein the scene category information includes: the confidence that the image to be processed is an indoor scene, and/or the confidence that the image to be processed is an outdoor scene degree, determining the target white balance gain based on the scene category information of the pixel block, including:
    确定所述待处理图像为室外场景时,所述像素块中的白点的第一目标权重,基于所述白点的RGB值和所述第一目标权重确定第一白平衡增益;When it is determined that the image to be processed is an outdoor scene, the first target weight of the white point in the pixel block is determined based on the RGB value of the white point and the first target weight to determine a first white balance gain;
    确定所述待处理图像为室内场景时,所述像素块中的白点的第二目标权重,基于所述白点的RGB值和所述第二目标权重确定第二白平衡增益;When it is determined that the image to be processed is an indoor scene, the second target weight of the white point in the pixel block is determined based on the RGB value of the white point and the second target weight to determine a second white balance gain;
    基于所述待处理图像为室内场景的置信度、所述待处理图像为室外场景的置信度,对所述第一白平衡增益和所述第二白平衡增益进行加权处理得到所述目标白平衡增益。Based on the confidence that the image to be processed is an indoor scene and the confidence that the image to be processed is an outdoor scene, perform weighting processing on the first white balance gain and the second white balance gain to obtain the target white balance gain.
  19. 根据权利要求1-13任一项所述的方法,其特征在于,基于所述像素块的场景类别信息确定目标白平衡增益,包括:The method according to any one of claims 1-13, wherein determining the target white balance gain based on the scene category information of the pixel block includes:
    确定所述待处理图像的初始白平衡增益;determining the initial white balance gain of the image to be processed;
    针对每个所述像素块,在确定所述像素块的RGB值落入混淆色的颜色区间的情况下,基于所述像素块的场景类别信息对所述像素块的所述初始白平衡增益进行补偿,得到所述像素块的目标白平衡增益。For each pixel block, when it is determined that the RGB value of the pixel block falls into the color interval of the confused color, the initial white balance gain of the pixel block is calculated based on the scene category information of the pixel block. compensation to obtain the target white balance gain of the pixel block.
  20. 根据权利要求19所述的方法,其特征在于,基于所述像素块的场景类别信息对所述初始白平衡增益进行补偿,得到目标白平衡增益,包括:The method according to claim 19, wherein the initial white balance gain is compensated based on scene category information of the pixel block to obtain a target white balance gain, comprising:
    基于所述像素块的场景类别信息确定补偿系数;determining a compensation coefficient based on the scene category information of the pixel block;
    利用所述补偿系数对所述初始白平衡增益进行补偿,得到所述目标白平衡增益。The compensation coefficient is used to compensate the initial white balance gain to obtain the target white balance gain.
  21. 根据权利要求20所述的方法,其特征在于,所述场景类别信息包 括所述像素块所属的目标物体类别,所述补偿系数基于以下方式确定:The method according to claim 20, wherein the scene category information includes the target object category to which the pixel block belongs, and the compensation coefficient is determined based on the following method:
    确定所述像素块中的第二指定区域的第三占比,其中,所述第二指定区域为所述像素块中RGB值落入混淆色的颜色区间区域;Determine the third proportion of the second specified area in the pixel block, wherein the second specified area is a color interval area in the pixel block whose RGB value falls into the confused color;
    基于所述第三占比、所述像素块所属的目标场景类别、所述像素块的亮度、所述待处理图像的前一帧图像对应的色温、所述待处理图像的前一帧图像对应的色调中的一个或多个确定所述补偿系数。Based on the third ratio, the target scene category to which the pixel block belongs, the brightness of the pixel block, the color temperature corresponding to the previous frame of the image to be processed, and the corresponding color temperature of the previous frame of the image to be processed One or more of the hues determine the compensation coefficients.
  22. 根据权利要求19-21任一项所述的方法,其特征在于,确定所述待处理图像的初始白平衡增益,包括:The method according to any one of claims 19-21, wherein determining the initial white balance gain of the image to be processed comprises:
    基于所述像素块的场景类别信息确定所述像素块中的白点的目标权重;determining the target weight of the white point in the pixel block based on the scene category information of the pixel block;
    基于所述白点的RGB值和所述目标权重确定所述待处理图像的初始白平衡增益。An initial white balance gain of the image to be processed is determined based on the RGB value of the white point and the target weight.
  23. 根据权利要求19-22任一项所述的方法,其特征在于,所述场景类别信息包括所述待处理图像为室内场景的置信度,以及所述待处理图像为室外场景的置信度,所述补偿系数包括所述待处理图像为室内场景下的第一补偿系数,以及所述待处理图像为室外场景下的第二补偿系数;The method according to any one of claims 19-22, wherein the scene category information includes a confidence degree that the image to be processed is an indoor scene, and a confidence degree that the image to be processed is an outdoor scene, so The compensation coefficient includes a first compensation coefficient when the image to be processed is an indoor scene, and a second compensation coefficient when the image to be processed is an outdoor scene;
    利用所述第一补偿系数对所述初始白平衡增益进行补偿,得到的第三白平衡增益;Compensating the initial white balance gain by using the first compensation coefficient to obtain a third white balance gain;
    利用所述第二补偿系数对所述初始白平衡增益进行补偿,得到第四白平衡增益;Compensating the initial white balance gain by using the second compensation coefficient to obtain a fourth white balance gain;
    基于所述待处理图像为室内场景的置信度以及所述待处理图像为室外场景的置信度,对所述第三白平衡增益和所述第四白平衡增益进行加权平均处理,得到所述目标白平衡增益。Based on the confidence that the image to be processed is an indoor scene and the confidence that the image to be processed is an outdoor scene, perform weighted average processing on the third white balance gain and the fourth white balance gain to obtain the target White balance gain.
  24. 根据权利要求1-23任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-23, wherein the method further comprises:
    对白平衡校正处理后的所述待处理图像进行氛围色处理。Ambient color processing is performed on the image to be processed after white balance correction processing.
  25. 一种图像处理装置,其特征在于,所述装置包括处理器、存储器、存储于所述存储器可供所述处理器执行的计算机程序,所述处理器执行所 述计算机程序时,可实现以下步骤:An image processing device, characterized in that the device includes a processor, a memory, and a computer program stored in the memory for execution by the processor, when the processor executes the computer program, the following steps can be realized :
    获取待处理图像;Get the image to be processed;
    确定所述待处理图像中的像素块的场景类别信息;determining scene category information of pixel blocks in the image to be processed;
    基于所述像素块的场景类别信息确定目标白平衡增益,以利用所述目标白平衡增益对所述待处理图像进行白平衡校正。Determine a target white balance gain based on the scene category information of the pixel block, so as to perform white balance correction on the image to be processed by using the target white balance gain.
  26. 根据权利要求25所述的装置,其特征在于,所述场景类别信息包括:所述像素块所属的目标物体类别和/或指示所述待处理图像为室内场景或室外场景的信息。The device according to claim 25, wherein the scene category information includes: the target object category to which the pixel block belongs and/or information indicating that the image to be processed is an indoor scene or an outdoor scene.
  27. 根据权利要求26所述的装置,其特征在于,其中,所述目标物体类别为预设的多个物体类别中的一个,所述预设的多个物体类别中的每个物体类别具有至少以下一种特性:The device according to claim 26, wherein the target object category is one of a plurality of preset object categories, and each object category in the preset plurality of object categories has at least the following A characteristic:
    所述每个物体类别可用于确定所述待处理图像为室内场景或室外场景;Each object category can be used to determine that the image to be processed is an indoor scene or an outdoor scene;
    所述每个物体类别可用于确定所述待处理图像中的白点;Each of the object categories can be used to determine the white point in the image to be processed;
    所述每个物体类别包含的场景的颜色区间与至少一种除所述场景以外的其他场景的颜色区间存在重叠区域。The color interval of the scene included in each object category overlaps with the color interval of at least one scene other than the scene.
  28. 根据权利要求25或27所述的装置,其特征在于,所述像素块所属的目标物体类别基于以下方式确定:The device according to claim 25 or 27, wherein the category of the target object to which the pixel block belongs is determined based on the following method:
    分别确定所述像素块为预设的多个物体类别中的每个物体类别的目标置信度;Respectively determining that the pixel block is a target confidence degree of each object category in a plurality of preset object categories;
    基于所述目标置信度从所述多个物体类别中确定所述像素块所属的目标物体类别。Determine the target object category to which the pixel block belongs from the plurality of object categories based on the target confidence.
  29. 根据权利要求28所述的装置,其特征在于,所述基于所述目标置信度从所述多个物体类别中确定所述像素块所属的目标物体类别,包括:The device according to claim 28, wherein the determining the target object category to which the pixel block belongs from the plurality of object categories based on the target confidence degree comprises:
    将所述目标置信度最大的物体类别作为所述像素块所属的目标物体类别。The object category with the highest target confidence is taken as the target object category to which the pixel block belongs.
  30. 根据权利要求28或29所述的装置,其特征在于,分别确定所述像素块为多个物体类别中的每个物体类别的目标置信度,包括:The device according to claim 28 or 29, wherein determining the target confidence of each object category in the plurality of object categories for the pixel block comprises:
    针对每个物体类别,基于预先训练的神经网络确定所述像素块为所述物体类别的初始置信度;For each object category, determine the initial confidence that the pixel block is the object category based on a pre-trained neural network;
    将所述初始置信度作为所述目标置信度;或using said initial confidence as said target confidence; or
    针对每个物体类别,基于预先训练的神经网络确定所述像素块为所述物体类别的初始置信度;For each object category, determine the initial confidence that the pixel block is the object category based on a pre-trained neural network;
    基于所述像素块的像素值相关信息对所述初始置信度进行调整,得到所述目标置信度。The initial confidence is adjusted based on the pixel value related information of the pixel block to obtain the target confidence.
  31. 根据权利要求30所述的装置,其特征在于,所述像素值相关信息包括以下一种或多种:The device according to claim 30, wherein the pixel value-related information includes one or more of the following:
    所述像素块的亮度、以及所述像素块中第一指定像素区域的第一占比,其中,所述第一指定像素区域的RGB值落入所述物体类别对应的颜色区间内。The brightness of the pixel block and the first proportion of the first specified pixel area in the pixel block, wherein the RGB value of the first specified pixel area falls within the color interval corresponding to the object category.
  32. 根据权利要求31所述的装置,其特征在于,所述目标置信度正相关于所述第一占比,所述目标置信度正相关于所述像素块的亮度与所述物体类别的标定亮度的接近程度。The device according to claim 31, wherein the target confidence level is positively related to the first proportion, and the target confidence level is positively related to the brightness of the pixel block and the nominal brightness of the object category the degree of proximity.
  33. 根据权利要求31所述的装置,其特征在于,在所述像素块的亮度小于预设亮度阈值的情况下,所述目标置信度为0。The device according to claim 31, wherein when the brightness of the pixel block is less than a preset brightness threshold, the target confidence level is 0.
  34. 根据权利要求25-33任一项所述的装置,其特征在于,指示所述待处理图像为室内场景或室外场景的信息包括:The device according to any one of claims 25-33, wherein the information indicating that the image to be processed is an indoor scene or an outdoor scene includes:
    所述待处理图像为室内场景的置信度、和/或所述待处理图像为室外场景的置信度。The confidence level that the image to be processed is an indoor scene, and/or the confidence level that the image to be processed is an outdoor scene.
  35. 根据权利要求34所述的装置,其特征在于,所述待处理图像为室内场景的置信度或室外场景的置信度基于以下方式确定:The device according to claim 34, wherein the confidence that the image to be processed is an indoor scene or the confidence of an outdoor scene is determined based on the following method:
    基于所述待处理图像中各像素块所属的目标物体类别确定属于各个目标物体类别的所有像素块在所述待处理图像中的第二占比;determining a second proportion of all pixel blocks belonging to each target object category in the image to be processed based on the target object category to which each pixel block in the image to be processed belongs;
    基于所述第二占比、以及各个目标物体类别对于室内场景的权重确定所述待处理图像为室内场景的置信度;或Determine the confidence that the image to be processed is an indoor scene based on the second proportion and the weight of each target object category for the indoor scene; or
    基于所述第二占比、以及各个目标物体类别对于室外场景的权重确定所述待处理图像为室外场景的置信度。Determine the confidence that the image to be processed is an outdoor scene based on the second ratio and the weights of each target object category for the outdoor scene.
  36. 根据权利要求35所述的装置,其特征在于,各个目标物体类别对于室内场景的权重或各个目标物体类别对于室内场景的权重基于以下一种或多种确定:属于各个目标物体类别的所有像素块的亮度、以及各个目标物体类别的类型。The device according to claim 35, wherein the weight of each target object category for the indoor scene or the weight of each target object category for the indoor scene is determined based on one or more of the following: all pixel blocks belonging to each target object category brightness, and the type of each target object category.
  37. 根据权利要求35或36所述的装置,其特征在于,所述第二占比基于以下方式确定:The device according to claim 35 or 36, wherein the second ratio is determined based on the following method:
    获取在所处待处理图像之前和/或之后采集的多帧目标图像;Acquiring multiple frames of target images collected before and/or after the image to be processed;
    对所述多帧目标图像中属于各个目标物体类别的所有像素块的占比,以及所述待处理图像中属于各个目标物体类别的像素块的占比进行滤波处理,得到所述第二占比。performing filtering processing on the proportions of all pixel blocks belonging to each target object category in the multi-frame target image and the proportions of pixel blocks belonging to each target object category in the image to be processed, to obtain the second proportion .
  38. 根据权利要求25-37任一项所述的装置,其特征在于,所述处理器用于基于所述像素块的场景类别信息确定目标白平衡增益时,具体用于:The device according to any one of claims 25-37, wherein when the processor is used to determine the target white balance gain based on the scene category information of the pixel block, it is specifically used for:
    基于所述像素块的场景类别信息确定所述像素块中的白点的目标权重;determining the target weight of the white point in the pixel block based on the scene category information of the pixel block;
    基于所述白点的RGB值和所述目标权重确定所述目标白平衡增益。The target white balance gain is determined based on the RGB value of the white point and the target weight.
  39. 根据权利要求38所述的装置,其特征在于,所述场景类别信息包括所述像素块所属的目标物体类别,所述目标物体类别不同时,所述目标权重不同;和/或The device according to claim 38, wherein the scene category information includes the target object category to which the pixel block belongs, and when the target object category is different, the target weight is different; and/or
    所述场景类别信息包括指示所述待处理图像为室内场景或室外场景的信息,所述待处理图像为室内场景下的所述目标权重,不同于所述待处理图像为室外场景时的所述目标权重。The scene category information includes information indicating that the image to be processed is an indoor scene or an outdoor scene, and the target weight of the image to be processed is an indoor scene, which is different from the target weight when the image to be processed is an outdoor scene. target weight.
  40. 根据权利要求38或39所述的装置,其特征在于,所述处理器用于基于所述像素块的场景类别信息确定所述像素块中的白点的目标权重时,具体用于:The device according to claim 38 or 39, wherein when the processor is used to determine the target weight of the white point in the pixel block based on the scene category information of the pixel block, it is specifically used to:
    确定所述像素块中的白点的初始权重;determining initial weights for white points in the pixel block;
    基于所述像素块的场景类别信息对所述初始权重进行调整,得到所述 像素块中的白点的目标权重。The initial weight is adjusted based on the scene category information of the pixel block to obtain the target weight of the white point in the pixel block.
  41. 根据权利要求40所述的装置,其特征在于,所述初始权重基于以下至少一种或多种确定:所述像素块的亮度、以及所述像素块对应的色温确定,其中,所述像素块对应的色温基于所述像素块的RGB值确定。The device according to claim 40, wherein the initial weight is determined based on at least one or more of the following: the brightness of the pixel block, and the color temperature corresponding to the pixel block, wherein the pixel block The corresponding color temperature is determined based on the RGB values of the pixel block.
  42. 根据权利要求38-41任一项所述的装置,其特征在于,所处场景类别信息包括:所述待处理图像为室内场景的置信度、和/或所述待处理图像为室外场景的置信度,所述处理器用于基于所述像素块的场景类别信息确定目标白平衡增益时,具体用于:The device according to any one of claims 38-41, wherein the scene category information includes: the confidence that the image to be processed is an indoor scene, and/or the confidence that the image to be processed is an outdoor scene degree, when the processor is used to determine the target white balance gain based on the scene category information of the pixel block, it is specifically used for:
    确定所述待处理图像为室外场景时,所述像素块中的白点的第一目标权重,基于所述白点的RGB值和所述第一目标权重确定第一白平衡增益;When it is determined that the image to be processed is an outdoor scene, the first target weight of the white point in the pixel block is determined based on the RGB value of the white point and the first target weight to determine a first white balance gain;
    确定所述待处理图像为室内场景时,所述像素块中的白点的第二目标权重,基于所述白点的RGB值和所述第二目标权重确定第二白平衡增益;When it is determined that the image to be processed is an indoor scene, the second target weight of the white point in the pixel block is determined based on the RGB value of the white point and the second target weight to determine a second white balance gain;
    基于所述待处理图像为室内场景的置信度、所述待处理图像为室外场景的置信度,对所述第一白平衡增益和所述第二白平衡增益进行加权处理得到所述目标白平衡增益。Based on the confidence that the image to be processed is an indoor scene and the confidence that the image to be processed is an outdoor scene, perform weighting processing on the first white balance gain and the second white balance gain to obtain the target white balance gain.
  43. 根据权利要求25-37任一项所述的装置,其特征在于,所述处理器用于基于所述像素块的场景类别信息确定目标白平衡增益时,具体用于:The device according to any one of claims 25-37, wherein when the processor is used to determine the target white balance gain based on the scene category information of the pixel block, it is specifically used for:
    确定所述待处理图像的初始白平衡增益;determining the initial white balance gain of the image to be processed;
    针对每个所述像素块,在确定所述像素块的RGB值落入混淆色的颜色区间的情况下,基于所述像素块的场景类别信息对所述像素块的所述初始白平衡增益进行补偿,得到所述像素块的目标白平衡增益。For each pixel block, when it is determined that the RGB value of the pixel block falls into the color interval of the confused color, the initial white balance gain of the pixel block is calculated based on the scene category information of the pixel block. compensation to obtain the target white balance gain of the pixel block.
  44. 根据权利要求43所述的装置,其特征在于,所述处理器用于基于所述像素块的场景类别信息对所述初始白平衡增益进行补偿,得到目标白平衡增益时,具体用于:The device according to claim 43, wherein the processor is configured to compensate the initial white balance gain based on the scene category information of the pixel block, and to obtain a target white balance gain, specifically for:
    基于所述像素块的场景类别信息确定补偿系数;determining a compensation coefficient based on the scene category information of the pixel block;
    利用所述补偿系数对所述初始白平衡增益进行补偿,得到所述目标白平衡增益。The compensation coefficient is used to compensate the initial white balance gain to obtain the target white balance gain.
  45. 根据权利要求44所述的装置,其特征在于,所述场景类别信息包括所述像素块所属的目标物体类别,所述补偿系数基于以下方式确定:The device according to claim 44, wherein the scene category information includes the target object category to which the pixel block belongs, and the compensation coefficient is determined based on the following method:
    确定所述像素块中的第二指定区域的第三占比,其中,所述第二指定区域为所述像素块中RGB值落入混淆色的颜色区间;Determine the third proportion of the second specified area in the pixel block, wherein the second specified area is a color interval in which the RGB value of the pixel block falls into the confused color;
    基于所述第三占比、所述像素块所属的目标场景类别、所述像素块的亮度、所述待处理图像的前一帧图像对应的色温、所述待处理图像的前一帧图像对应的色调中的一个或多个确定所述补偿系数。Based on the third ratio, the target scene category to which the pixel block belongs, the brightness of the pixel block, the color temperature corresponding to the previous frame of the image to be processed, and the corresponding color temperature of the previous frame of the image to be processed One or more of the hues determine the compensation coefficients.
  46. 根据权利要求44-45任一项所述的装置,其特征在于,所述处理器用于确定所述待处理图像的初始白平衡增益时,具体用于:The device according to any one of claims 44-45, wherein when the processor is used to determine the initial white balance gain of the image to be processed, it is specifically used for:
    基于所述像素块的场景类别信息确定所述像素块中的白点的目标权重;determining the target weight of the white point in the pixel block based on the scene category information of the pixel block;
    基于所述白点的RGB值和所述目标权重确定所述待处理图像的初始白平衡增益。An initial white balance gain of the image to be processed is determined based on the RGB value of the white point and the target weight.
  47. 根据权利要求43-46任一项所述的装置,其特征在于,所述场景类别信息包括所述待处理图像为室内场景的置信度,以及所述待处理图像为室外场景的置信度,所述补偿系数包括所述待处理图像为室内场景下的第一补偿系数,以及所述待处理图像为室外场景下的第二补偿系数;The device according to any one of claims 43-46, wherein the scene category information includes the confidence level that the image to be processed is an indoor scene, and the confidence level that the image to be processed is an outdoor scene, so The compensation coefficient includes a first compensation coefficient when the image to be processed is an indoor scene, and a second compensation coefficient when the image to be processed is an outdoor scene;
    利用所述第一补偿系数对所述初始白平衡增益进行补偿,得到的第三白平衡增益;Compensating the initial white balance gain by using the first compensation coefficient to obtain a third white balance gain;
    利用所述第二补偿系数对所述初始白平衡增益进行补偿,得到第四白平衡增益;Compensating the initial white balance gain by using the second compensation coefficient to obtain a fourth white balance gain;
    基于所述待处理图像为室内场景的置信度以及所述待处理图像为室外场景的置信度,对所述第三白平衡增益和所述第四白平衡增益进行加权平均处理,得到所述目标白平衡增益。Based on the confidence that the image to be processed is an indoor scene and the confidence that the image to be processed is an outdoor scene, perform weighted average processing on the third white balance gain and the fourth white balance gain to obtain the target White balance gain.
  48. 根据权利要求25-47任一项所述的装置,其特征在于,所述处理器还用于:The device according to any one of claims 25-47, wherein the processor is further configured to:
    对白平衡校正处理后的所述待处理图像进行氛围色处理。Ambient color processing is performed on the image to be processed after white balance correction processing.
  49. 一种图像采集设备,其特征在于,所述图像采集设备包括如权利 要求25-48任一项所述的图像处理装置。An image acquisition device, characterized in that the image acquisition device comprises the image processing device according to any one of claims 25-48.
  50. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被执行时实现如权利要求1-24任一项所述的方法。A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed, the method according to any one of claims 1-24 is realized.
PCT/CN2021/141521 2021-12-27 2021-12-27 Image processing method and apparatus, image acquisition device, and storage medium WO2023122860A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/141521 WO2023122860A1 (en) 2021-12-27 2021-12-27 Image processing method and apparatus, image acquisition device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/141521 WO2023122860A1 (en) 2021-12-27 2021-12-27 Image processing method and apparatus, image acquisition device, and storage medium

Publications (1)

Publication Number Publication Date
WO2023122860A1 true WO2023122860A1 (en) 2023-07-06

Family

ID=86996786

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/141521 WO2023122860A1 (en) 2021-12-27 2021-12-27 Image processing method and apparatus, image acquisition device, and storage medium

Country Status (1)

Country Link
WO (1) WO2023122860A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100149420A1 (en) * 2008-12-11 2010-06-17 Texas Instruments Incorporated Method and apparatus for improving automatic white balance with scene information
CN107801012A (en) * 2017-10-30 2018-03-13 广东欧珀移动通信有限公司 White balancing treatment method and device, electronic installation and computer-readable recording medium
CN112243119A (en) * 2019-07-19 2021-01-19 杭州海康威视数字技术股份有限公司 White balance processing method and device, electronic equipment and storage medium
CN113329217A (en) * 2021-06-30 2021-08-31 展讯半导体(南京)有限公司 Automatic white balance parameter processing method and device, and computer readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100149420A1 (en) * 2008-12-11 2010-06-17 Texas Instruments Incorporated Method and apparatus for improving automatic white balance with scene information
CN107801012A (en) * 2017-10-30 2018-03-13 广东欧珀移动通信有限公司 White balancing treatment method and device, electronic installation and computer-readable recording medium
CN112243119A (en) * 2019-07-19 2021-01-19 杭州海康威视数字技术股份有限公司 White balance processing method and device, electronic equipment and storage medium
CN113329217A (en) * 2021-06-30 2021-08-31 展讯半导体(南京)有限公司 Automatic white balance parameter processing method and device, and computer readable storage medium

Similar Documents

Publication Publication Date Title
US20200260001A1 (en) Global Tone Mapping
CN109712102B (en) Image fusion method and device and image acquisition equipment
US8013907B2 (en) System and method for adaptive local white balance adjustment
US8717459B2 (en) Method and apparatus for improving automatic white balance with scene information
CN112752023B (en) Image adjusting method and device, electronic equipment and storage medium
JP2004007545A (en) Method for automatic white balance of digital image
TW448411B (en) Global white point detection and white balance for color images
US20100309344A1 (en) Chroma noise reduction for cameras
WO2018068300A1 (en) Image processing method and device
CN104157003B (en) Thermal image detail enhancement method based on normal distribution adjustment
He et al. Single image dehazing with white balance correction and image decomposition
CN114866754B (en) Automatic white balance method and device, computer readable storage medium and electronic equipment
CN113850738B (en) Correction device and method for purple fringing of image
WO2023122860A1 (en) Image processing method and apparatus, image acquisition device, and storage medium
CN109451292B (en) Image color temperature correction method and device
CN108012135A (en) Image processing method and device, computer-readable recording medium and computer equipment
JP5327766B2 (en) Memory color correction in digital images
WO2022067761A1 (en) Image processing method and apparatus, capturing device, movable platform, and computer readable storage medium
CN113362261A (en) Image fusion method
WO2023000868A1 (en) Image processing method and apparatus, device, and storage medium
WO2019137396A1 (en) Image processing method and device
US20080079749A1 (en) White balance method for image processing
Garud et al. A fast color constancy scheme for automobile video cameras
CN114866755B (en) Automatic white balance method and device, computer storage medium and electronic equipment
US20230033975A1 (en) Adaptive image shading correction method and adaptive image shading correction system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21969248

Country of ref document: EP

Kind code of ref document: A1