Summary of the invention
Embodiment of the invention technical problem to be solved is, a kind of colour temperature control method, device and terminal are provided, and can realize simply, quickly and easily that the colour temperature of image or picture is regulated.
In order to solve the problems of the technologies described above, the embodiment of the invention provides a kind of colour temperature control method, be used to regulate the colour temperature of image or picture, comprise: obtain the current red component intensity of image to be regulated or the pixel in the picture, current green component intensity and current blue component intensity; Adopt preassigned color temperature value, the current red component intensity of described pixel, current green component intensity and current blue component intensity are recomputated.
Wherein, the described current red component intensity of image to be regulated or the pixel in the picture, current green component intensity and the current blue component intensity obtained, comprise: travel through image to be regulated or the pixel in the picture, obtain the current red component intensity of the described pixel that traverses, current green component intensity and current blue component intensity; Whether judgement is finished the traversal of image described to be regulated or the pixel in the picture, if do not finish, then continues traversal.
Wherein, the span of described preassigned color temperature value is :-100~100.
Wherein, the preassigned color temperature value of described employing, the current red component intensity of described pixel, current green component intensity and current blue component intensity are recomputated, comprise: adopt formula: regulate back red component intensity=current red component intensity+color temperature value, calculate red component intensity after the described pixel adjustment; Adopt formula: regulate back green component intensity=current green component intensity-color temperature value/2, calculate green component intensity after the described pixel adjustment; Adopt formula: regulate back blue component intensity=current blue component intensity-color temperature value, calculate blue component intensity after the described pixel adjustment.
Wherein, the preassigned color temperature value of described employing, the current red component intensity of described pixel, current green component intensity and current blue component intensity are recomputated, also comprise: judge that whether the value of regulating back red component intensity is greater than 255, if greater than, the value that then will regulate back red component intensity is changed to 255; Whether judge the value of regulating back red component intensity less than 0, if less than, the value that then will regulate back red component intensity is changed to 0; Whether judge the value of regulating back green component intensity greater than 255, if greater than, the value that then will regulate back green component intensity is changed to 255; Whether judge the value of regulating back green component intensity less than 0, if less than, the value that then will regulate back green component intensity is changed to 0; Whether judge the value of regulating back blue component intensity greater than 255, if greater than, the value that then will regulate back blue component intensity is changed to 255; Whether judge the value of regulating back blue component intensity less than 0, if less than, the value that then will regulate back blue component intensity is changed to 0.
Correspondingly, the embodiment of the invention also provides a kind of colour temperature adjusting device, be used to regulate the colour temperature of image or picture, comprise: acquisition module is used for obtaining current red component intensity, current green component intensity and the current blue component intensity of the pixel of image to be regulated or picture; The colour temperature adjustment module is used to adopt preassigned color temperature value, and current red component intensity, current green component intensity and the current blue component intensity of the pixel that described acquisition module is obtained recomputate.
Wherein, described acquisition module comprises: travel through the unit, be used for traveling through the pixel of image or picture to be regulated;
Acquiring unit is used to obtain current red component intensity, current green component intensity and the current blue component intensity of the pixel of described traversal unit traversal; Judging unit is used for judging whether described traversal unit finishes the traversal to the pixel of image described to be regulated or picture, if do not finish, then controls described traversal unit and proceeds traversal.
Wherein, the span of described preassigned color temperature value is :-100~100.
Wherein, described colour temperature adjustment module comprises: red colour temperature regulon is used to adopt formula: regulate back red component intensity=current red component intensity+color temperature value, calculate red component intensity after the described pixel adjustment; Green colour temperature regulon is used to adopt formula: regulate back green component intensity=current green component intensity-color temperature value/2, calculate green component intensity after the described pixel adjustment; Blue colour temperature regulon is used to adopt formula: regulate back blue component intensity=current blue component intensity-color temperature value, calculate blue component intensity after the described pixel adjustment.
Wherein, whether described red colour temperature regulon also is used to judge the value of regulating back red component intensity greater than 255, if greater than, the value that then will regulate back red component intensity is changed to 255; Whether judge the value of regulating back red component intensity less than 0, if less than, the value that then will regulate back red component intensity is changed to 0; Whether described green colour temperature regulon also is used to judge the value of regulating back green component intensity greater than 255, if greater than, the value that then will regulate back green component intensity is changed to 255; Whether judge the value of regulating back green component intensity less than 0, if less than, the value that then will regulate back green component intensity is changed to 0; Whether described blue colour temperature regulon also is used to judge the value of regulating back blue component intensity greater than 255, if greater than, the value that then will regulate back blue component intensity is changed to 255; Whether judge the value of regulating back blue component intensity less than 0, if less than, the value that then will regulate back blue component intensity is changed to 0.
Implement the embodiment of the invention, have following beneficial effect: the embodiment of the invention adopts preassigned color temperature value that the current red component intensity of pending image or the pixel in the picture, current green component intensity and current blue component intensity are recomputated, and realizes the colour temperature of image or picture is regulated.Regulate owing to directly carry out colour temperature according to preassigned color temperature value, its process is simple, convenient, can require to realize the adjustment of image or picture apace according to user's colour temperature, has promoted user's experience.
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 is obtained under the creative work prerequisite.
Seeing also Fig. 1, is the schematic flow sheet of colour temperature control method first embodiment of the embodiment of the invention, and described method comprises the steps:
Step S11 obtains the current red component intensity of image to be regulated or the pixel in the picture, current green component intensity and current blue component intensity.
At RGB (Red, Green, Blue, RGB) in the color mode, each pixel is formed according to certain mixed by redness, green and blueness, and red, green and blueness shared proportion in a pixel is called red component intensity, green component intensity and blue component intensity; The span of red component intensity, green component intensity and blue component intensity is all between 0~255 simultaneously; For ater, its red component intensity, green component intensity and blue component intensity are 0.
Obtain the current red component intensity of image to be regulated or the pixel in the picture, current green component intensity and current blue component intensity, specifically comprise: travel through image to be regulated or the pixel in the picture, obtain the current red component intensity of the described pixel that traverses, current green component intensity and current blue component intensity; Whether judgement is finished the traversal of image described to be regulated or the pixel in the picture, if do not finish, then continues traversal.
Step S12 adopts preassigned color temperature value, and the current red component intensity of described pixel, current green component intensity and current blue component intensity are recomputated.
In this step, preassigned color temperature value represents with temp, is to be used for key parameter that the colour temperature of image or picture is regulated.Its span is set according to actual needs, such as span is :-100~100.The image after the big or small directly influence of the value of the color temperature value temp adjusting or the changes in temperature degree of picture, color temperature value temp is big more usually, and the image after the expression adjusting or the color of picture are warm more; In a kind of execution mode, work as temp=0, expression is not carried out any adjusting to the colour temperature of image or picture; When temp>0, the colour temperature of image or picture is warmed in expression; When temp<0, expression turns cold the colour temperature of image or picture.In actual applications, the size of color temperature value temp can be specified by the user.
In this step, a kind of mode that the current red component intensity of pixel, current green component intensity and current blue component intensity are recomputated is: adopt following formula that the current red component intensity of pixel, current green component intensity and current blue component intensity are recomputated, red component intensity, green component intensity and blue component intensity after adjusted.
Adopt formula: regulate back red component intensity=current red component intensity+color temperature value, calculate red component intensity after the pixel adjustment;
Adopt formula: regulate back green component intensity=current green component intensity-color temperature value/2, calculate green component intensity after the pixel adjustment;
Adopt formula: regulate back blue component intensity=current blue component intensity-color temperature value, calculate blue component intensity after the pixel adjustment.
Further, also the size of regulating back red component intensity, green component intensity and blue component intensity is judged in this step, determined the value of component intensity according to judged result, particularly:
Whether judge the value of regulating back red component intensity greater than 255, if greater than, the value that then will regulate back red component intensity is changed to 255; Whether judge the value of regulating back red component intensity less than 0, if less than, the value that then will regulate back red component intensity is changed to 0.
Whether judge the value of regulating back green component intensity greater than 255, if greater than, the value that then will regulate back green component intensity is changed to 255; Whether judge the value of regulating back green component intensity less than 0, if less than, the value that then will regulate back green component intensity is changed to 0.
Whether judge the value of regulating back blue component intensity greater than 255, if greater than, the value that then will regulate back blue component intensity is changed to 255; Whether judge the value of regulating back blue component intensity less than 0, if less than, the value that then will regulate back blue component intensity is changed to 0.
Above-mentioned colour temperature control method, directly the colour temperature of image or picture is regulated according to preassigned color temperature value, its process is simple, convenient, can be apace require to realize adjusting to the colour temperature of image or picture according to user's colour temperature, helps to promote user's experience.
Please refer to Fig. 2, is the schematic flow sheet of second embodiment of the colour temperature control method of the embodiment of the invention, and described method comprises the steps:
Step S21 obtains preassigned color temperature value.
Step S22: travel through image to be regulated or the pixel in the picture.
Step S23: obtain the current red component intensity of the pixel that traverses, current green component intensity and current blue component intensity.
Step S24 adopts preassigned color temperature value, and the current red component intensity of described pixel, current green component intensity and current blue component intensity are recomputated.
Step S25 judges whether to finish traversal, if do not have, then returns step S22 and continues to treat the image of adjusting or traveling through of the pixel in the picture.
Correspondingly, the embodiment of the invention also provides a kind of colour temperature adjusting device, this colour temperature adjusting device can be integrated in mobile phone, PC(Personal Computer, personal computer), PDA(Personal Digital Assistant, personal digital assistant) or in the car-mounted terminal etc., is used for the colour temperature of image or picture is regulated.
Seeing also Fig. 3, is the structural representation of embodiment of the colour temperature adjusting device of the embodiment of the invention, and described colour temperature adjusting device 3 comprises:
Acquisition module 4 is used for obtaining current red component intensity, current green component intensity and the current blue component intensity of the pixel of image to be regulated or picture.
Colour temperature adjustment module 5 is used to adopt preassigned color temperature value, and current red component intensity, current green component intensity and the current blue component intensity of the pixel that acquisition module 31 is obtained recomputate.
Wherein, preassigned color temperature value represents with temp, is to be used for key parameter that the colour temperature of image or picture is regulated.Its span is set according to actual needs, such as span is :-100~100.The image after the big or small directly influence of the value of the color temperature value temp adjusting or the changes in temperature degree of picture, color temperature value temp is big more usually, and the image after the expression adjusting or the color of picture are warm more; Such as working as temp=0, expression is not carried out any adjusting to the colour temperature of image or picture; When temp>0, the colour temperature of image or picture is warmed in expression; When temp<0, expression turns cold the colour temperature of image or picture.In actual applications, the size of color temperature value temp can be specified by the user.
Please refer to Fig. 4, is the structural representation of embodiment of the acquisition module 4 of the embodiment of the invention, and described acquisition module 4 comprises:
Travel through unit 41, be used for traveling through the pixel of image or picture to be regulated.
Acquiring unit 42 is used to obtain current red component intensity, current green component intensity and the current blue component intensity of the pixel that traversal unit 41 traverses.
Judging unit 43 is used for judging whether described traversal unit 41 finishes the traversal to image described to be regulated or picture pixel, if do not finish, then controls described traversal unit 41 and proceeds traversal.
Please refer to Fig. 5, is the structural representation of embodiment of the colour temperature adjustment module 5 of the embodiment of the invention, and described colour temperature adjustment module 5 comprises:
Red colour temperature regulon 51 is used to adopt formula: regulate back red component intensity=current red component intensity+color temperature value, calculate red component intensity after the adjusting of pixel; Further, red colour temperature regulon 51 is also judged the value of regulating back red component intensity, if the red color component intensity greater than 255, then is changed to 255 with red component intensity; If red component intensity less than 0, then is changed to 0 with red component intensity.
Green colour temperature regulon 52 is used to adopt formula: regulate back green component intensity=current green component intensity-color temperature value/2, calculate green component intensity after the adjusting of pixel; Further, red colour temperature regulon 51 is also judged the value of regulating back red component intensity, if the red color component intensity greater than 255, then is changed to 255 with red component intensity; If red component intensity less than 0, then is changed to 0 with red component intensity.
Blue colour temperature regulon 53 is used to adopt formula: regulate back blue component intensity=current blue component intensity-color temperature value, calculate blue component intensity after the adjusting of pixel; Further, red colour temperature regulon 51 is also judged the value of regulating back red component intensity, if the red color component intensity greater than 255, then is changed to 255 with red component intensity; If red component intensity less than 0, then is changed to 0 with red component intensity.
The colour temperature adjusting device 3 of the embodiment of the invention, directly the colour temperature of image or picture is regulated according to preassigned color temperature value, its process is simple, convenient, can be apace require to realize adjusting to the colour temperature of image or picture according to user's colour temperature, helps to promote user's experience.
One of ordinary skill in the art will appreciate that all or part of flow process that realizes in the foregoing description method, be to instruct relevant hardware to finish by computer program, described program can be stored in the computer read/write memory medium, this program can comprise the flow process as the embodiment of above-mentioned each side method when carrying out.Wherein, described storage medium can be magnetic disc, CD, read-only storage memory body (Read-Only Memory, ROM) or at random store memory body (Random Access Memory, RAM) etc.
Above disclosed only is a kind of preferred embodiment of the present invention, certainly can not limit the present invention's interest field with this, one of ordinary skill in the art will appreciate that all or part of flow process that realizes the foregoing description, and, still belong to the scope that invention is contained according to the equivalent variations that claim of the present invention is done.