Summary of the invention
The embodiment of the invention provides a kind of method and apparatus of adjusting image property, and is excessive to avoid when regulating the image attributes of YUV image amount of calculation, the problem that consumes resources is many.
The embodiment of the invention provides a kind of method of adjusting image property, comprising:
Obtain the image attributes parameter of YUV image;
Described image attributes parameter is regulated the image attributes after obtaining to regulate according to default strategy.
Wherein, described image attributes parameter comprises following one of them or combination in any:
Brightness, contrast, saturation and colourity.
Wherein, when the image attributes parameter is brightness, the Y component in the YUV image is regulated; The step of then described image attributes parameter being regulated according to default strategy comprises:
When the direction of brightness Y-direction increase is regulated,
Y′=Y+B
Wherein, Y is the brightness value before the Image Adjusting, and Y ' is the brightness value behind the brightness adjustment, and B is the value of brightness regulation;
When the direction that reduces when the brightness Y-direction is regulated,
Y′=min(Y,Y″)
Wherein, Y is the brightness value before the Image Adjusting, and Y ' is the brightness value behind the brightness adjustment, Y " is the maximum after the brightness regulation.
Wherein, when the image attributes parameter is contrast, the Y component in the YUV image is regulated; The step of then described image attributes parameter being regulated according to default strategy comprises:
When contrast is regulated to the direction that increases,
Y′=Y*C
Wherein, Y is the brightness value before the Image Adjusting, and Y ' is the brightness value behind the brightness adjustment, and C is the contrast adjustment value;
When contrast is regulated to the direction that reduces,
Y′=A+(Y-A)*C
Wherein, Y is the brightness value before the Image Adjusting, and Y ' is the brightness value behind the brightness adjustment, and C is the contrast adjustment value, and A is a radix value.
Wherein, when the image attributes parameter is saturation, the U in the YUV image and V component are regulated; The step of then described image attributes parameter being regulated according to default strategy comprises:
U′=((U-128)*S)+128
V′=((V-128)*S)+128
Wherein, U is the blue difference signal value before the Image Adjusting, and U ' is the red color difference signal value before the Image Adjusting for the blue difference signal value after adjusting, V, and V ' is the red color difference signal value after adjusting, and S is the saturation regulated value.
Wherein, when the image attributes parameter is colourity, the U in the YUV image and V component are regulated; The step of then described image attributes parameter being transferred according to default strategy comprises:
U′=(U-128)*cosθ+(V-128)*sinθ+128
V′=(V-128)*cosθ-(U-128)*sinθ+128
Wherein, U is the blue difference signal value before the Image Adjusting, and U ' is the red color difference signal value before the Image Adjusting for the blue difference signal value after adjusting, V, and V ' is the red color difference signal value after adjusting, and θ is the colourity regulated quantity.
Wherein, described method further comprises: practical adjustments amount and slide block regulated quantity are the non-linear increasing relation, and the variation of B value increases with the regulated quantity of brightness, reduces thereupon reducing.
Wherein, brightness regulation to image is carried out self adaptation to the mean picture brightness before regulating, if the integral body of image before regulating is brighter, then the odds ratio of practical adjustments amount and slide block regulated quantity is larger, if image overall brightness before regulating is less, then the ratio of practical adjustments amount and slide block regulated quantity is also smaller.
Wherein, described method further comprises:
The regulated quantity of described saturation is carried out adaptive change to image brightness, and the practical adjustments amount of saturation reduces along with the increase of brightness, increases along with the increase of contrast, reduces when the brightness and contrast reduces simultaneously thereupon.
The embodiment of the invention also provides a kind of device of adjusting image property, comprising:
Parameter acquisition module is for the image attributes parameter of obtaining the YUV image;
Adjustment module is used for described image attributes parameter is regulated according to default strategy, the image attributes after obtaining to regulate.
Wherein, described image attributes parameter comprises following one of them or combination in any:
Brightness, contrast, saturation and colourity.
Wherein, further comprise:
The brightness adaptation module, when being used for the brightness regulation to image, if the integral body of image is brighter, then regulated quantity is larger, if integral image brightness is less, then regulated quantity is also less.
Wherein, further comprise:
The comprehensive adjustment module, the regulated quantity that is used for controlling described saturation reduces along with the increase of brightness, increases along with the increase of contrast, and when reducing simultaneously along with the brightness and contrast and reduce.
Use the adjusting image property method and apparatus that the embodiment of the invention provides, saved twice module converts of YUV~RGB and RGB~HSV, avoid when regulating the image attributes of YUV image amount of calculation excessive, the problem that consumes resources is many, because can directly carry out attribute for the YUV view data regulates, transfer so that the resource that adjustment process takies seldom, has improved the efficient of regulating greatly.
Have, the embodiment of the present application has increased the method for the brightness of image self being carried out dynamic adjustments again, has improved the video effect of image adjustment, and through test comparison, regulating effect of the present invention is better than through carrying out the control method of color attribute after the color model conversion.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
Referring to Fig. 1, it is the flow chart according to a kind of adjusting image property method of the embodiment of the invention.Specifically comprise:
Step 101 is obtained the image attributes parameter of YUV image;
Concrete, the image attributes parameter comprises following one of them or combination in any: brightness, contrast, saturation and colourity;
Step 102 is regulated according to default strategy described image attributes parameter, the image attributes after obtaining to regulate.
Use the adjusting image property method that the embodiment of the invention provides, saved twice module converts of YUV~RGB and RGB~HSV, avoid when regulating the image attributes of YUV image amount of calculation excessive, the problem that consumes resources is many, because can directly carry out attribute for the YUV view data regulates, transfer so that the resource that adjustment process takies seldom, has improved the efficient of regulating greatly.
Have, the embodiment of the present application has increased the method for the brightness of image self being carried out dynamic adjustments again, has improved the video effect of image adjustment, and through test comparison, regulating effect of the present invention is better than through carrying out the control method of color attribute after the color model conversion.
The mode that a kind of possible image attributes to the YUV image is regulated can adopt the regulative mode of slide block, as shown in Figure 2, can design respectively a slider bar for brightness, contrast, saturation and colourity, when slide block is in the centre position of slider bar, show and regulate, when slide block is moved to the left, show that this component is to the direction adjusting that reduces, when slide block is wanted to move right, show that this component is to the direction adjusting that increases.Among Fig. 2, regulated quantity is divided into 100 grades, the centre position is 50, and this position shows to be regulated this moment.Regulating maximum magnitude left is 0, and regulating maximum magnitude to the right is 100, about the adjusting grade all be 50.Reset button is used for after brightness, contrast, saturation and colourity are regulated four sliding shoes being returned to the centre position.
The below respectively brightness regulation, contrast adjustment, saturation is regulated and the colourity adjusting is elaborated.
Actual to the adjusting of brightness is that the Y component in the YUV image is regulated.The step of in the step 102 described image attributes parameter being regulated according to default strategy at this moment, comprises:
When the direction of brightness Y-direction increase is regulated,
Y′=Y+B (1)
Wherein, Y is the brightness value before the Image Adjusting, and Y ' is the brightness value behind the brightness adjustment, and B is the value of brightness regulation;
When the direction that reduces when the brightness Y-direction is regulated,
Y′=min(Y,Y″) (2)
Wherein, Y is the brightness value before the Image Adjusting, and Y ' is the brightness value behind the brightness adjustment, Y " is the maximum after the brightness regulation.
The situation that the direction that reduces for the brightness Y-direction is regulated, the tonal range of default image is 0~255 before regulating, tonal range is 0~Y after regulating ", the value B=|255-Y of brightness regulation ".
When brightness was regulated to the direction that increases, the variation of B value increased with the regulated quantity of brightness, reducing and reduce with regulated quantity.When brightness was regulated to the direction that reduces, the variation of B value increased with the regulated quantity of brightness, reducing and reduce with regulated quantity.The relation of regulated quantity and B value is nonlinear monotonically increasing.The B value is relevant with the attribute of image own in addition, be designed in the embodiment of the present application the mean flow rate of image is carried out self adaptation, first the mean picture brightness before regulating is carried out self adaptation during also namely to the brightness regulation of image, if the integral body brighter (namely mean flow rate larger) of image before regulating, then practical adjustments amount and slide block regulated quantity is larger frequently, if image overall brightness before regulating is less, then the ratio of practical adjustments amount and slide block regulated quantity is also smaller.Namely the brightness regulation curve carries out self adaptation to the original brightness value of image.
Referring to Fig. 3, it is according to the schematic diagram that concerns between the B value of the embodiment of the invention and the brightness adjustment.Among Fig. 3, abscissa is the regulated quantity of brightness slide block, and scope is 0-100, and ordinate is the practical adjustments amount, and scope is 0-255, i.e. B in the corresponding adjusting of the value of the ordinate formula, and abscissa is actual regulated quantity.Dotted line is the regulating effect of integral image brightness when larger among the figure, and solid line is the overall brightness regulating effect hour of image.
Adjusting reality to contrast also is that the Y component in the YUV image is regulated.The step of in the step 102 described image attributes parameter being regulated according to default strategy at this moment, comprises:
When contrast is regulated to the direction that increases,
Y′=Y*C (3)
Wherein, Y is the brightness value before the Image Adjusting, and Y ' is the brightness value behind the brightness adjustment, and C is the contrast adjustment value;
When contrast is regulated to the direction that reduces,
Y′=A+(Y-A)*C (4)
Wherein, Y is the brightness value before the Image Adjusting, and Y ' is the brightness value behind the brightness adjustment, and C is the contrast adjustment value, and A is a radix value.In actual applications, A can get arbitrary value, and A can get 30 in a preferred embodiment.
The variation of above-mentioned C value increases with the regulated quantity of contrast, reduce thereupon reducing, but discord contrast adjustment amount is proportional, but in the contrast adjustment amount more hour, gray scale (also being brightness Y) increases sooner, and when the contrast adjustment amount was larger, it is slower that gray scale increases.The C value is affected by brightness adjustment, and when brightness adjustment was larger, the C value reduced thereupon.Equally, the C value has been carried out self adaptation to the overall brightness of image, for the difference of image averaging gray scale, and C value big or small different.
Referring to Fig. 4, it is according to the schematic diagram that concerns between the C value of the embodiment of the invention and the contrast adjustment amount.Among Fig. 4, abscissa represents the regulated quantity of contrast slide block, and scope is 0-100, ordinate represents the practical adjustments effect of contrast, and scope is 0-2, and solid line a is that integral image brightness is less, when brightness is regulated to the direction that reduces, the relation of contrast slide block regulated quantity and actual contrast regulated value.Dotted line b is that integral image brightness is larger, when brightness is regulated to the direction that reduces, and the relation of contrast slide block regulated quantity and actual contrast regulated value.
Need to prove, the embodiment of the present application combines brightness and contrast's adjusting, and brightness regulation and contrast adjustment are combined, and interacts, to reach better regulating effect.
When preventing that the integral image gray scale is larger, the brightness and contrast regulates the excessive phenomenon of adjusting that causes to the direction that increases simultaneously, and the safeguard measure when being provided with this kind situation suppresses excessively to regulate phenomenon.Braking measure is, regulates and regulated quantity when all large to the direction that increases simultaneously the brightness and contrast, reduces brightness and contrast's practical adjustments amount.
The adjusting of saturation is the mould of regulating the vector of carrier chrominance signal U, V component composition, and the larger saturation of mould is larger, otherwise less.
The relation of color harmony saturation as shown in Figure 5, among Fig. 5, U is blue difference signal, V is red color difference signal, the value of angle θ is the regulated quantity of tone, the mould of vectorial b is the regulated quantity of saturation.The below elaborates to the adjustment process of saturation and colourity again.
Actual to the adjusting of saturation is that the U in the YUV image and V component are regulated.The step of in the step 102 described image attributes parameter being regulated according to default strategy at this moment, comprises:
U′=((U-128)*S)+128 (5)
V′=((V-128)*S)+128 (6)
Wherein, U is the blue difference signal value before the Image Adjusting, and U ' is the red color difference signal value before the Image Adjusting for the blue difference signal value after adjusting, V, and V ' is the red color difference signal value after adjusting, and S is the saturation regulated value.Wherein, value centered by 128.
In the YUV image space, the change of Y component can cause the change of colourity, and in order to obtain better effect, the regulated quantity of the saturation of image is affected by brightness and contrast's regulated quantity, the regulated quantity of saturation reduces along with the increase of brightness, increases along with the increase of contrast; And reduce along with reducing of brightness and contrast.That is to say, the regulated quantity of saturation is carried out adaptive change to image brightness, and the practical adjustments amount of saturation reduces along with the increase of brightness, increases along with the increase of contrast, reduces when the brightness and contrast reduces simultaneously thereupon.
Referring to Fig. 6, it is the schematic diagram that concerns according to the regulated quantity S of the saturation of the embodiment of the invention and saturation slide block adjusting position and brightness, contrast.Among Fig. 6, abscissa represents the position of saturation adjusting slider, and ordinate represents the practical adjustments amount of saturation.The adjustable range of abscissa is 0~100,50 centers when regulating for slide block, and this moment, saturation was not regulated.The adjustable range of ordinate is 0~2.0 for to be adjusted to minimum with saturation, and this moment, saturation was 0, and namely image does not have colouring information.Among Fig. 6, solid line a is in initial position for brightness and contrast's adjusting slider, when being unadjusted state, regulate separately the position of saturation slide block and the relation of actual saturation, when dotted line b regulates to the direction that reduces for the brightness and contrast, regulate the position of saturation slide block and the relation of actual saturation, dotted line c is brightness or contrast when regulating to the direction that increases, and regulates the position of saturation slide block and the relation of actual saturation.
In the adjusting of tone, adopt the regulative mode of colour circle in the embodiment of the invention.
Adjusting reality to colourity also is that the U in the YUV image and V component are regulated.The step of in the step 102 described image attributes parameter being regulated according to default strategy at this moment, comprises:
U′=(U-128)*cosθ+(V-128)*sinθ+128 (7)
V′=(V-128)*cosθ-(U-128)*sinθ+128 (8)
Wherein, U is the blue difference signal value before the Image Adjusting, and U ' is the red color difference signal value before the Image Adjusting for the blue difference signal value after adjusting, V, and V ' is the red color difference signal value after adjusting, and θ is the colourity regulated quantity.Wherein, value centered by 128.
Use the method that the embodiment of the invention provides, each width of cloth picture is processed, also just can be processed each two field picture of video, therefore be not subjected to the restriction of the scope of application of picture and video, both be applicable to picture and regulated pattern, and also be applicable to video and regulate pattern.
The embodiment of the invention also provides a kind of device of adjusting image property, referring to Fig. 7, specifically comprises:
Parameter acquisition module 701 is for the image attributes parameter of obtaining the YUV image;
Adjustment module 702 is used for described image attributes parameter is regulated according to default strategy, the image attributes after obtaining to regulate.
Above-mentioned image attributes parameter comprises following one of them or combination in any: brightness, contrast, saturation and colourity.
Said apparatus may further include:
The brightness adaptation module, when being used for the brightness regulation to image, if the integral body of image is brighter, then regulated quantity is larger, if integral image brightness is less, then regulated quantity is also less.
Said apparatus can further include:
The comprehensive adjustment module, the regulated quantity that is used for controlling described saturation reduces along with the increase of brightness, increases along with the increase of contrast, and when reducing simultaneously along with the brightness and contrast and reduce.
Use the adjusting image property device that the embodiment of the invention provides, saved twice module converts of YUV~RGB and RGB~HSV, avoid when regulating the image attributes of YUV image amount of calculation excessive, the problem that consumes resources is many, because can directly carry out attribute for the YUV view data regulates, so that the resource that adjustment process takies seldom, improved greatly the efficient of regulating.
Have, the embodiment of the present application has increased the method for the brightness of image self being carried out dynamic adjustments again, has improved the video effect of image adjustment, and through test comparison, regulating effect of the present invention is better than through carrying out the control method of color attribute after the color model conversion.
For device embodiment because its basic simlarity is in embodiment of the method, so describe fairly simple, relevant part gets final product referring to the part explanation of embodiment of the method.
Need to prove, in this article, such as term " comprise ", " comprising " or its any other variant be intended to contain comprising of nonexcludability, thereby not only comprise those key elements so that comprise process, method, article or the equipment of a series of key elements, but also comprise other key elements of clearly not listing, or also be included as the intrinsic key element of this process, method, article or equipment.In the situation that not more restrictions, the key element that is limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment that comprises described key element and also have other identical element.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the said method execution mode is to come the relevant hardware of instruction to finish by program, described program can be stored in the computer read/write memory medium, here alleged storage medium, as: ROM/RAM, magnetic disc, CD etc.
The above is preferred embodiment of the present invention only, is not for limiting protection scope of the present invention.All any modifications of doing within the spirit and principles in the present invention, be equal to replacement, improvement etc., all be included in protection scope of the present invention.