A kind of image processing method, terminal and computer readable storage mediumTechnical field
The present invention relates to the image processing techniques in electronic application field more particularly to a kind of image processing method, terminalsAnd computer readable storage medium.
Background technology
In recent years, with the rapid development of Internet technology and mobile communication network technology, many such as mobile phone, tablet computerTerminal all has camera function, and user can take pictures in arbitrary application and environment using terminal.And to the image of shooting intoThe purpose of row automatic white balance (automatic white balance, AWB) processing is the color channel by changing terminalGain carries out unified benefit to the deviation of the misalignment caused by colour temperature environment and terminal intrinsic color channel gains in itselfIt repays, so as to allow the image of acquisition that can correctly reflect the realistic colour of object.
In the prior art, when under dark or night environment, when user's using terminal is taken pictures, terminal can be by openingThe functions such as flash lamp are opened to increase exposure, complete the shooting function of terminal, still, due to the difference of shooting environmental, are closed by dodgingThe processing of white balance of lamp adjustment when taking pictures be it is single, no differentiation, the image so shot it is second-rate, also result inCross-color.
The content of the invention
In order to solve the above technical problems, an embodiment of the present invention is intended to provide a kind of image processing method, terminal and computersReadable storage medium storing program for executing, the quality of image procossing when can improve shooting improve the validity of color of image.
The technical proposal of the invention is realized in this way:
An embodiment of the present invention provides a kind of image processing method, including:
When preflashing function is opened, the first white balance parameter is obtained, first white balance parameter is not open flash lampWhen obtain;
Preflashing is carried out to target object, the preflashing image of the target object is gathered and the reference white of preflashing reference point is put downWeigh parameter, and obtains second white balance parameter;
According to the preflashing reference point, the quantity of preflashing effective pixel points in the preflashing image is determined;
The shooting instruction for opening flash lamp is received, responds the shooting instruction, obtains the 3rd white balance parameter;
Quantity based on the preflashing effective pixel points, first white balance parameter, second white balance parameter and3rd white balance parameter, determines current white balance parameter;
The captured image collected using the current white balance parameter processing.
It is the quantity based on the preflashing effective pixel points, first white balance parameter, described in said programSecond white balance parameter and the 3rd white balance parameter, determine current white balance parameter, including:
When the quantity of the preflashing effective pixel points is more than default flash of light upper limit threshold, by second white balance parameterIt is determined as the current white balance parameter;
When the quantity of the preflashing effective pixel points is less than default flash of light lower threshold, joined based on first white balanceNumber and the 3rd white balance parameter, obtain intermediate white balance parameter, the intermediate white balance parameter are determined as described currentWhite balance parameter;
When the quantity of the preflashing effective pixel points is between the default flash of light lower threshold and the default flash of light upper limitWhen between threshold value, based on first white balance parameter and the 3rd white balance, intermediate white balance parameter is obtained, based on describedIntermediate white balance parameter and second white balance parameter determine the current white balance parameter.
It is described based on first white balance parameter and the 3rd white balance parameter in said program, obtain centreWhite balance parameter, including:
Obtain current environment brightness value;
When the current environment brightness value is more than default ambient brightness upper limit value, using the 3rd white balance parameter asThe intermediate white balance parameter;
When the current environment brightness value is less than default ambient brightness lower limiting value, using first white balance parameter asThe intermediate white balance parameter;
When the current environment brightness value is between the default ambient brightness lower limiting value and the default ambient brightness upper limitWhen between value, first white balance parameter and the 3rd white balance parameter are weighted to obtain the intermediate white balance parameter.
In said program, determined based on the intermediate white balance parameter and second white balance parameter described current whiteBalance parameters, including:
The intermediate white balance parameter and second white balance parameter weighting are determined into the current white balance parameter.
In said program, the second white balance parameter of the acquisition, including:
According to the preflashing reference point, the preflashing effective pixel points of the preflashing image are obtained;
Based on the preflashing effective pixel points and the preflashing reference point, the weight of preflashing effective pixel points is determined;
Obtain the preflashing available point white balance parameter of preflashing effective pixel points;
According to the preflashing available point white balance parameter and the weight of the preflashing effective pixel points, it is white to obtain described secondBalance parameters.
In said program, the 3rd white balance parameter of the acquisition, including:
According to the main sudden strain of a muscle reference point, the main sudden strain of a muscle effective pixel points of the captured image are obtained;
Based on the main sudden strain of a muscle effective pixel points and the main sudden strain of a muscle reference point, the main weight for dodging effective pixel points is determined;
Obtain the main sudden strain of a muscle available point white balance parameter of main sudden strain of a muscle effective pixel points;
According to the main weight for dodging available point white balance parameter and the main sudden strain of a muscle effective pixel points, it is white to obtain the described 3rdBalance parameters.
It is described after the captured image collected using the current white balance parameter processing in said programMethod further includes:
The captured image that treated described in display.
In said program, before the first white balance parameter of the acquisition, the method further includes:
Receive preflashing function open command;
The preset function open command is responded, opens the preflashing function.
An embodiment of the present invention provides a kind of terminal, including:Processor, storage medium, receiver, image pick-up device, displayAnd communication bus, the receiver, the storage medium, the image pick-up device and the display by the communication bus withThe processor connection communication;The processor is used to perform the image processing program stored in the storage medium, to realizeAbove-mentioned image processing method.
It is described computer-readable an embodiment of the present invention provides an embodiment of the present invention provides a kind of computer storage mediaStorage medium is stored with one or more image processing program, and one or more of programs can be by one or moreIt manages device to perform, to realize above-mentioned image processing method.
An embodiment of the present invention provides a kind of image processing method, terminal and computer readable storage medium, when preflashing work(When can open, the first white balance parameter is obtained, the first white balance parameter is obtained when not opening flash lamp;To target object intoRow preflashing gathers the preflashing image of target object and the reference white balance parameter of preflashing reference point, and obtains the second white balanceParameter;Foundation preflashing reference point determines the quantity of preflashing effective pixel points in preflashing image;The shooting for receiving unlatching flash lamp refers toOrder responds shooting instruction, obtains the 3rd white balance parameter;Quantity based on preflashing effective pixel points, the first white balance parameter,Two white balance parameters and the 3rd white balance parameter, determine current white balance parameter;It is handled and collected using current white balance parameterCaptured image.Using above-mentioned technic relization scheme, since terminal (can not open flash lamp, preflashing and master based on Three modelsDodge) corresponding three groups of white balance parameters, to do the processing of different white balance parameters, so as to dynamically adjust current white balanceParameter so that using the Quality advance of the captured image of current white balance parameter processing, and then improve the image of captured imageThe validity of color.
Description of the drawings
Fig. 1 is a kind of hardware architecture diagram of optional mobile terminal provided in an embodiment of the present invention;
Fig. 2 is a kind of communications network system Organization Chart provided in an embodiment of the present invention;
Fig. 3 is a kind of flow chart one of image processing method provided in an embodiment of the present invention;
Fig. 4 sets figure for a kind of illustrative interface provided in an embodiment of the present invention;
Fig. 5 is the corresponding RGB numerical value schematic diagram of different colours in the embodiment of the present invention;
Fig. 6 is the corresponding RGB numeric distributions schematic diagram of different colours in the embodiment of the present invention;
Fig. 7 is the multicolour schematic diagram based on three primary colours in the embodiment of the present invention;
Fig. 8 is illustrative AWB values zoning schematic diagram provided in an embodiment of the present invention;
Fig. 9 is illustrative processing result image comparison diagram provided in an embodiment of the present invention;
Figure 10 is a kind of flowchart 2 of image processing method provided in an embodiment of the present invention;
Figure 11 is a kind of structure diagram of terminal provided in an embodiment of the present invention.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, completeSite preparation describes.
In subsequent description, using for representing that the suffix of such as " module ", " component " or " unit " of element is onlyBe conducive to the explanation of the present invention, itself there is no a specific meaning.Therefore, " module ", " component " or " unit " can mixGround uses.
Terminal in the embodiment of the present invention can be electronic equipment with camera shooting or shooting function etc., the embodiment of the present inventionIt is not restricted.
Terminal can be implemented in a variety of manners.For example, terminal described in the present invention can include such as mobile phone, tabletComputer, laptop, palm PC, personal digital assistant (Personal Digital Assistant, PDA), portableThe shiftings such as media player (Portable Media Player, PMP), guider, wearable device, Intelligent bracelet, pedometerThe dynamic fixed terminals such as terminal and number TV, desktop computer.
It will be illustrated in subsequent descriptions by taking mobile terminal as an example, it will be appreciated by those skilled in the art that except specialFor moving outside the element of purpose, construction according to the embodiment of the present invention can also apply to the terminal of fixed type.
Referring to Fig. 1, its to realize the present invention a kind of optional mobile terminal of each embodiment hardware configuration signalFigure, the mobile terminal 100 can include:RF (Radio Frequency, radio frequency) unit 101, Wi-Fi module 102, audio are defeatedGo out unit 103, A/V (audio/video) input unit 104, sensor 105, display unit 106, user input unit 107, connectThe components such as mouth unit 108, memory 109, processor 110 and power supply 111.It will be understood by those skilled in the art that in Fig. 1The mobile terminal structure shown does not form the restriction to mobile terminal, and mobile terminal can include more more or fewer than illustratingComponent either combines some components or different components arrangement.
The all parts of mobile terminal are specifically introduced with reference to Fig. 1:
Radio frequency unit 101 can be used for receiving and sending messages or communication process in, signal sends and receivees, specifically, by base stationDownlink information receive after, handled to processor 110;In addition, by the data sending of uplink to base station.In general, radio frequency unit 101Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier, duplexer etc..In addition, it penetratesFrequency unit 101 can also be communicated by wireless communication with network and other equipment.Above-mentioned wireless communication can use any communicationStandard or agreement include but not limited to GSM (Global System of Mobile communication, global system for mobile telecommunicationsSystem), GPRS (General Packet Radio Service, general packet radio service), CDMA2000 (CodeDivision Multiple Access 2000, CDMA 2000), WCDMA (Wideband Code DivisionMultiple Access, wideband code division multiple access), TD-SCDMA (Time Division-Synchronous CodeDivision Multiple Access, TD SDMA), FDD-LTE (Frequency DivisionDuplexing-Long Term Evolution, frequency division duplex Long Term Evolution) and TDD-LTE (Time DivisionDuplexing-Long Term Evolution, time division duplex Long Term Evolution) etc..
Wi-Fi belongs to short range wireless transmission technology, and mobile terminal can help user to receive and dispatch by Wi-Fi module 102Email, browsing webpage and access streaming video etc., it has provided wireless broadband internet to the user and has accessed.Although Fig. 1Show Wi-Fi module 102, but it is understood that, and must be configured into for mobile terminal is not belonging to, it completely can basisIt needs to omit in the scope of essence for not changing invention.
Audio output unit 103 can be in call signal reception pattern, call mode, record mould in mobile terminal 100Formula, speech recognition mode, broadcast reception mode when under isotypes, by radio frequency unit 101 or Wi-Fi module 102 it is receiving orThe voice data that person stores in memory 109 is converted into audio signal and exports as sound.Moreover, audio output unit103 can also provide with mobile terminal 100 perform the relevant audio output of specific function (for example, call signal receive sound,Message sink sound etc.).Audio output unit 103 can include loud speaker, buzzer etc..
Mobile terminal 100 further includes at least one sensor 105, such as optical sensor, motion sensor and other biographiesSensor.Specifically, optical sensor includes ambient light sensor and proximity sensor, wherein, ambient light sensor can be according to environmentThe light and shade of light adjusts the brightness of display panel 1061, and proximity sensor can close when mobile terminal 100 is moved in one's earDisplay panel 1061 and/or backlight.As one kind of motion sensor, accelerometer sensor can detect in all directions (generalFor three axis) size of acceleration, size and the direction of gravity are can detect that when static, the application available for identification mobile phone posture(such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, percussion) etc.;The fingerprint sensor that can also configure as mobile phone, pressure sensor, iris sensor, molecule sensor, gyroscope, barometer,The other sensors such as hygrometer, thermometer, infrared ray sensor, details are not described herein.
Display unit 106 is used to show by information input by user or be supplied to the information of user.Display unit 106 can wrapDisplay panel 1061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode may be employedForms such as (Organic Light-Emitting Diode, OLED) configure display panel 1061.
User input unit 107 can be used for the number for receiving input or character information and generation and the use of mobile terminalThe key signals input that family is set and function control is related.Specifically, user input unit 107 may include touch panel 1071 withAnd other input equipments 1072.Touch panel 1071, also referred to as touch-screen, collect user on it or neighbouring touch operation(for example user uses any suitable objects such as finger, stylus or attachment on touch panel 1071 or in touch panel 1071Neighbouring operation), and corresponding attachment device is driven according to preset formula.Touch panel 1071 may include touch detectionTwo parts of device and touch controller.Wherein, the touch orientation of touch detecting apparatus detection user, and detect touch operation bandThe signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by itContact coordinate is converted into, then gives processor 110, and the order that processor 110 is sent can be received and performed.It in addition, canTo realize touch panel 1071 using polytypes such as resistance-type, condenser type, infrared ray and surface acoustic waves.Except touch panel1071, user input unit 107 can also include other input equipments 1072.Specifically, other input equipments 1072 can wrapIt includes but is not limited to physical keyboard, in function key (such as volume control button, switch key etc.), trace ball, mouse, operation lever etc.One or more, do not limit herein specifically.
Further, touch panel 1071 can cover display panel 1061, when touch panel 1071 detect on it orAfter neighbouring touch operation, processor 110 is sent to determine the type of touch event, is followed by subsequent processing device 110 according to touch thingThe type of part provides corresponding visual output on display panel 1061.Although in Fig. 1, touch panel 1071 and display panel1061 be the component independent as two to realize the function that outputs and inputs of mobile terminal, but in certain embodiments, it canThe function that outputs and inputs of mobile terminal is realized so that touch panel 1071 and display panel 1061 is integrated, is not done herein specificallyIt limits.
Interface unit 108 be used as at least one external device (ED) be connected with mobile terminal 100 can by interface.For example,External device (ED) can include wired or wireless head-band earphone port, external power supply (or battery charger) port, wired or nothingLine data port, memory card port, the port for device of the connection with identification module, audio input/output (I/O) endMouth, video i/o port, ear port etc..Interface unit 108 can be used for receiving the input from external device (ED) (for example, numberIt is believed that breath, electric power etc.) and the input received is transferred to one or more elements in mobile terminal 100 or can be withFor transmitting data between mobile terminal 100 and external device (ED).
Memory 109 can be used for storage software program and various data.Memory 109 can mainly include storing program areaAnd storage data field, wherein, storing program area can storage program area, application program (such as the sound needed at least one functionSound playing function, image player function etc.) etc.;Storage data field can store according to mobile phone use created data (such asVoice data, phone directory etc.) etc..In addition, memory 109 can include high-speed random access memory, can also include non-easyThe property lost memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts.
Processor 110 is the control centre of mobile terminal, utilizes each of various interfaces and the entire mobile terminal of connectionA part is stored in storage by running or performing the software program being stored in memory 109 and/or module and callData in device 109 perform the various functions of mobile terminal and processing data, so as to carry out integral monitoring to mobile terminal.PlaceReason device 110 may include one or more processing units;Preferably, processor 110 can integrate application processor and modulatedemodulate is mediatedDevice is managed, wherein, the main processing operation system of application processor, user interface and application program etc., modem processor is mainHandle wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 110.
Mobile terminal 100 can also be included to the power supply 111 (such as battery) of all parts power supply, it is preferred that power supply 111Can be logically contiguous by power-supply management system and processor 110, so as to realize management charging by power-supply management system, putThe functions such as electricity and power managed.
Although Fig. 1 is not shown, mobile terminal 100 can also be including bluetooth module etc., and details are not described herein.
For the ease of understanding the embodiment of the present invention, below to the communications network system that is based on of mobile terminal of the present invention intoRow description.
Referring to Fig. 2, Fig. 2 is a kind of communications network system Organization Chart provided in an embodiment of the present invention, the communication network systemIt unites as the LTE system of universal mobile communications technology, UE (User Equipment, use of the LTE system including communicating connection successivelyFamily equipment) 201, E-UTRAN (Evolved UMTS Terrestrial Radio Access Network, evolved UMTS landsGround wireless access network) 202, EPC (Evolved Packet Core, evolved packet-based core networks) 203 and operator IP operation204。
Specifically, UE201 can be above-mentioned terminal 100, and details are not described herein again.
E-UTRAN202 includes eNodeB2021 and other eNodeB2022 etc..Wherein, eNodeB2021 can be by returningJourney (backhaul) (such as X2 interface) is connected with other eNodeB2022, and eNodeB2021 is connected to EPC203,ENodeB2021 can provide the access of UE201 to EPC203.
EPC203 can include MME (Mobility Management Entity, mobility management entity) 2031, HSS(Home Subscriber Server, home subscriber server) 2032, other MME2033, SGW (Serving Gate Way,Gateway) 2034, PGW (PDN Gate Way, grouped data network gateway) 2035 and PCRF (Policy andCharging Rules Function, policy and rate functional entity) 2036 etc..Wherein, MME2031 be processing UE201 andThe control node of signaling, provides carrying and connection management between EPC203.HSS2032 is all to manage for providing some registersSuch as the function of attaching position register (not shown) etc, and some are preserved in relation to use such as service features, data ratesThe dedicated information in family.All customer data can be sent by SGW2034, and PGW2035 can provide the IP of UE 201Address is distributed and other functions, and PCRF2036 is business data flow and the strategy of IP bearing resources and charging control strategic decision-makingPoint, it selects and provides available strategy and charging control decision-making with charge execution function unit (not shown) for strategy.
IP operation 204 can include internet, Intranet, IMS (IP Multimedia Subsystem, IP multimediaSystem) or other IP operations etc..
Although above-mentioned be described by taking LTE system as an example, those skilled in the art it is to be understood that the present invention not onlySuitable for LTE system, be readily applicable to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA withAnd following new network system etc., it does not limit herein.
Terminal in the embodiment of the present invention can be mobile terminal, then, illustratively, based on above-mentioned mobile terminal hardwareStructure and communications network system can propose each embodiment of the method for the present invention.Following terminals can utilize mobile terminalTo replace.
Embodiment one
An embodiment of the present invention provides a kind of image processing method, as shown in figure 3, this method can include:
S101, when preflashing function is opened, obtain the first white balance parameter, the first white balance parameter is not open flash lampWhen obtain;
It should be noted that a kind of image pickup method provided in an embodiment of the present invention is under the scene taken pictures in terminalIt realizes.
It is noted that the image pick-up device of terminal in the embodiment of the present invention on be provided with imaging sensor, which leads toImaging sensor acquisition captured image is crossed, wherein, after captured image starts shooting function for the camera applications in terminal, in terminalDisplay screen on the image collected, for example, preview image etc..
In the embodiment of the present invention, before shooting instruction is received, the image of terminal acquisition is all by preview interfaceWhat preview image obtained.
Optionally, terminal can be picture pick-up device and be equipped with equipment that camera shooting is applied etc..Specific terminal can be to setIt is equipped with camera shooting application, and the electronic equipments such as mobile phone, tablet, computer with flash function.Wherein, the realization of flash function can be withIt is realized by the flash lamp being arranged on image pick-up device, the embodiment of the present invention does not limit realization method and the setting side of flash functionFormula.
In the embodiment of the present invention terminal acquisition be target object image, wherein, the target object can be personage,The objects such as building, landscape, the embodiment of the present invention are not restricted.
In embodiments of the present invention, user's using terminal is taken pictures, after user starts the camera applications of terminal, the endEnd carries out target object by imaging sensor the acquisition of the acquisition, i.e. preview image of captured image.Wherein, imaging sensorBe arranged on the image pick-up device in terminal (camera), specifically such as image pick-up device can be terminal device front camera orPerson's rear camera etc., the embodiment of the present invention is not restricted.
It should be noted that the image processing method used in the embodiment of the present invention is suitable for processing figure in different environmentsAs the situation of color, and such case can appear in shooting environmental as when night, daytime, light intensity or backlight, this hairA kind of image processing method of proposition can be arranged to a kind of optimization image processing function in terminal by bright embodiment, in userOr ambient enviroment is when need, at image when can be shot by opening this kind of preferable optimization image processing functionReason, and other when existing image procossing mode still may be employed take pictures to realize.So, terminal is adopted when taking picturesWhich kind of with image procossing mode, then detect whether to open optimization image processing function by terminal to realize, if optimization figureIt opens as processing function and is then realized using image processing method provided in an embodiment of the present invention;If optimize image processing function notIt opens, is then taken pictures using existing image procossing mode to realize.The namely embodiment of the present invention can be compatible with and existing figureAs processing mode and optimization image procossing mode two provided in an embodiment of the present invention, the compatibility for carrying out image procossing is improvedAnd diversity.
In embodiments of the present invention, terminal detects whether that it can be by detection terminal to open optimization image processing functionOptimization image processing function button whether is opened in setting to realize.As shown in figure 4, in the camera applications of mobile phone (terminal)In, camera set interface in, be provided with optimization image processing function switch button, user can by clicking on "ON" button,The optimization image processing function on the mobile phone is opened, the optimization image on the mobile phone can also be closed by clicking on "Off" buttonProcessing function.
It should be noted that a kind of image processing method provided in an embodiment of the present invention is mainly used in needing out flash lampUnder the scene of shooting.In the present invention is implemented, terminal when shooting, may be employed and not open three kinds of flash lamp, preflashing and main sudden strain of a muscle mouldsFormula, when preflashing function is opened, but before also not carrying out preflashing to the preview image of preview interface, terminal can be directed at this time notThe preview image under flash lamp is opened, obtains the first white balance parameter of the preview image, is i.e. the first white balance parameter is not openIt is obtained during flash lamp.
In embodiments of the present invention, terminal has the function of preflashing and main sudden strain of a muscle function, and main sudden strain of a muscle function refers to really open flash of lightPattern during lamp.Preflashing is the advance flash of light trial pattern before flash lamp is really opened.
It should be noted that in an embodiment of the present invention, rgb color pattern is a kind of color standard of industrial quarters, isBy of all kinds to obtain to red (R), green (G), the variation of blue (B) three Color Channels and their mutual superpositionsColor, RGB is the color for representing three passages of red, green, blue, this standard, which almost includes human eyesight, to be perceivedAll colours, be current with one of most wide color system.
Illustratively, the corresponding RGB numerical value schematic diagram of different colours in the embodiment of the present invention as shown in Figure 5, in Figure 5For different colors, corresponding RGB numerical value is also different, wherein, R values, G values, the numerical value of B values maximum are 255, minimum numerical valueFor 0.Fig. 6 is the corresponding RGB numeric distributions schematic diagram of different colours in the embodiment of the present invention, as shown in figure 4, different colours correspond toRGB numerical value distribution it is different.Fig. 7 is the multicolour schematic diagram based on three primary colours in the embodiment of the present invention, as shown in fig. 7,All colours in nature can be mixed by the three primary colours of red, green, blue according to different ratios, for example, according toCertain proportion is mixed red with green, can obtain yellow.
In embodiments of the present invention, the calculating of white balance parameter (AWB) is all obtained using RGB numerical value, here whiteBalance parameters refer to (D1, the D2) that is calculated according to formula (1) and formula (2) that formula (1) and formula (2) are as follows:
D1=R/G (1)
D2=B/G (2)
Wherein, R is the red channel R values of above-mentioned terminal, and B is the blue channel B values of above-mentioned terminal, and G is above-mentioned terminalGreen channel G values.
It should be noted that in an embodiment of the present invention, D1 can be used for embodying warm colour colour temperature, and correspondingly, D2 can be withFor embodying cool colour colour temperature.
In this way, in the embodiment of the present invention terminal can based on the white balance parameter obtained under different screening-modes intoThe image procossing of row different scenes or environment.
It should be noted that here, each pixel that terminal can be directed to preview image at this time calculates white balance parameter,Finally averagely obtain the first white balance parameter.And the 3rd white balance under preflashing pattern under the second white balance parameter and main sudden strain of a muscle patternParameter will illustrate in the embodiment below.
S102, preflashing is carried out to target object, gathers the preflashing image of target object and the reference white of preflashing reference pointBalance parameters, and obtain the second white balance parameter;
When preflashing function is opened, after terminal obtains the first white balance parameter, since terminal has had been switched on preflashing work(Can, therefore, terminal can carry out preflashing to the preview image at this time of target object, collect preflashing image, herein, terminal canThe parameter of light source during with according to preflashing, obtains the reference point of the light source, i.e. preflashing reference point and according to formula (1) and public affairsThe reference white balance parameter that formula (2) calculates the preflashing reference point can also carry out preflashing image the meter of white balance parameterIt calculates, i.e. the acquisition of the second white balance parameter.
In embodiments of the present invention, the process of the second white balance parameter of terminal acquisition can be:Terminal is referred to according to preflashingPoint obtains the preflashing effective pixel points of preflashing image;Based on preflashing effective pixel points and preflashing reference point, the effective picture of preflashing is determinedThe weight of vegetarian refreshments;Obtain the preflashing available point white balance parameter of preflashing effective pixel points;According to preflashing available point white balance parameterWith the weight of preflashing effective pixel points, the second white balance parameter is obtained.
It should be noted that Fig. 8 be AWB values zoning schematic diagram, as shown in figure 8, circular indicia be reference point (such asPreflashing reference point) distribution in R/G, B/G coordinate system, it is square to be identified as when the pixel in preceding camera the image collectedThe distribution of (such as preflashing pixel) in R/G, B/G coordinate system, star be identified as with reference to reference point weight (such as preflashing referencePoint weight) and pixel weight (such as weight of preflashing pixel) calculate acquisition AWB values.
In embodiments of the present invention, terminal can be according to the distributing position of reference point in Fig. 8 (such as preflashing reference point), reallyThe image slices vegetarian refreshments in an effective coverage of preflashing image is determined for preflashing effective pixel points, such as the picture in the region 1 in Fig. 8Vegetarian refreshments is just preflashing effective pixel points, according to the distance between preflashing effective pixel points and preflashing reference point, determines that preflashing is effectiveThe weight of pixel, the weight of more remote preflashing effective pixel points is smaller with a distance from preflashing reference point, with a distance from preflashing reference pointThe weight of nearer preflashing effective pixel points is bigger.In this way, terminal has just got the corresponding power of each preflashing effective pixel pointsIt is effective to have obtained each preflashing further according to the RGB numerical value and formula (1) and formula (2) of each default effective pixel points for weight, terminalThe R/G and B/G (i.e. preflashing available point white balance parameter) of pixel, then, terminal according to preflashing available point white balance parameter andAll preflashing effective pixel points are weighted and averagely obtain the second white balance parameter by the weight of preflashing effective pixel points.
It should be noted that in embodiments of the present invention, the effective district of preflashing reference point can be divided into multiple gradesCircle, the weight of the preflashing effective pixel points in each grade circle is consistent, with a distance from preflashing reference point in nearer grade circlePreflashing effective pixel points weight it is bigger.The weight summation of all grade circles is 1.
S103, foundation preflashing reference point determine the quantity of preflashing effective pixel points in preflashing image;
Terminal-pair target object carries out preflashing, gathers the preflashing image of target object and the reference white of preflashing reference point is put downAfter the parameter that weighs, which can determine the preflashing effective pixel points in preflashing image according to effective coverage, then the endEnd can also get the quantity of the preflashing effective pixel points in the effective coverage, refer here to all in effective coverageThe summation of preflashing effective pixel points.
S104, the shooting instruction for opening flash lamp is received, responds shooting instruction, obtain the 3rd white balance parameter;
Terminal determines that in preflashing image after the quantity of preflashing effective pixel points, which can according to preflashing reference pointTo carry out the operation of main sudden strain of a muscle pattern, i.e. the terminal receives the shooting instruction for opening flash lamp function, and target object is shot,At this moment, which can carry out the preview image (main sudden strain of a muscle image) when opening flash lamp the calculating of white balance parameter, herein,The parameter of light source when terminal can be according to main sudden strain of a muscle, obtains the reference point of the light source, i.e. preflashing reference point and according to formula(1) and formula (2) is to the main reference white balance parameter for dodging reference point and calculating, and can also carry out white balance ginseng to main sudden strain of a muscle imageThe acquisition of several calculating, i.e. the 3rd white balance parameter.
In embodiments of the present invention, the process of the 3rd white balance parameter of terminal acquisition can be:According to main sudden strain of a muscle reference point, obtainTake the main sudden strain of a muscle effective pixel points of captured image;Based on main sudden strain of a muscle effective pixel points and main sudden strain of a muscle reference point, main sudden strain of a muscle effective pixel points are determinedWeight;Obtain the main sudden strain of a muscle available point white balance parameter of main sudden strain of a muscle effective pixel points;According to main sudden strain of a muscle available point white balance parameter and masterThe weight of effective pixel points is dodged, obtains the 3rd white balance parameter.
It should be noted that Fig. 8 be AWB values zoning schematic diagram, as shown in figure 8, circular indicia be reference point (such asPreflashing reference point) distribution in R/G, B/G coordinate system, it is square to be identified as when the pixel in preceding camera the image collectedThe distribution of (such as preflashing pixel) in R/G, B/G coordinate system, star be identified as with reference to reference point weight (such as preflashing referencePoint weight) and pixel weight (such as weight of preflashing pixel) calculate acquisition AWB values.
In embodiments of the present invention, terminal can be according to the distributing position of reference point in Fig. 8 (such as main sudden strain of a muscle reference point), reallyThe picture in the region 1 in effective pixel points, such as Fig. 8 is dodged based on image slices vegetarian refreshments in a fixed main effective coverage for dodging imageVegetarian refreshments dodges effective pixel points with regard to based on, according to the distance between main sudden strain of a muscle effective pixel points and main sudden strain of a muscle reference point, determines main dodge effectivelyThe weight of pixel, the weight of more remote main sudden strain of a muscle effective pixel points is smaller with a distance from main sudden strain of a muscle reference point, with a distance from main sudden strain of a muscle reference pointThe weight of nearer main sudden strain of a muscle effective pixel points is bigger.In this way, terminal has just got the corresponding power of each main sudden strain of a muscle effective pixel pointsIt is effective to have obtained each main sudden strain of a muscle further according to the RGB numerical value and formula (1) and formula (2) of each default effective pixel points for weight, terminalThe R/G and B/G (i.e. main sudden strain of a muscle available point white balance parameter) of pixel, then, terminal according to main sudden strain of a muscle available point white balance parameter andAll main sudden strain of a muscle effective pixel points are weighted and averagely obtain the 3rd white balance parameter by the main weight for dodging effective pixel points.
It should be noted that in embodiments of the present invention, the effective district of main sudden strain of a muscle reference point can be divided into multiple gradesCircle, the weight of the main sudden strain of a muscle effective pixel points in each grade circle is consistent, with a distance from main sudden strain of a muscle reference point in nearer grade circleMain sudden strain of a muscle effective pixel points weight it is bigger.The weight summation of all grade circles is 1.
S105, the quantity based on preflashing effective pixel points, the first white balance parameter, the second white balance parameter and the 3rd are white flatWeigh parameter, determines current white balance parameter;
After terminal obtains the 3rd white balance parameter, the number for the preflashing effective pixel points that terminal has been got at this timeAmount, the first white balance parameter, the second white balance parameter and the 3rd white balance parameter, due in embodiments of the present invention, terminal meetingIt undergoes successively and does not open Flash Mode, preflashing pattern and main sudden strain of a muscle pattern, and realized based on above-mentioned Three models to varying environment feelingsThree groups of white balance parameters under condition carry out the decision-making of current white balance parameter.Therefore, terminal is in shooting, collecting again to shooting figureIt, can the quantity based on preflashing effective pixel points, the first white balance parameter, the second white balance parameter and the 3rd white balance ginseng during pictureNumber, determines current white balance parameter.
It should be noted that in the embodiment of the present invention, terminal can consider the number of the quantity of preflashing effective pixel points firstTo carry out determining for actual current white balance parameter.Terminal is mainly according to default flash of light upper limit threshold and default flash of light upper limit thresholdValue judges whether effective pixel points during preflashing represent the demand of most pixel enough, if can represent, then straightConnect with preflashing when the second white balance parameter with regard to much of that, if but if cannot representing, it is necessary to consider further that other two kinds of mouldsIn the case of the first white balance parameter and the 3rd white balance parameter that are obtained under formula, the processing of current white balance parameter is carried out.
Here, the quantity, the first white balance parameter, the second white balance parameter and the 3rd based on preflashing effective pixel points are white flatWeigh parameter, and determining the process of current white balance parameter can be:When the quantity of preflashing effective pixel points is more than the default flash of light upper limitDuring threshold value, the second white balance parameter is determined as the current white balance parameter;When the quantity of preflashing effective pixel points is less than in advanceIf during flash of light lower threshold, based on the first white balance parameter and the 3rd white balance parameter, intermediate white balance parameter is obtained, by centreWhite balance parameter is determined as current white balance parameter;When preflashing effective pixel points quantity between default flash of light upper limit threshold with it is pre-If when between the upper limit threshold that glistens, based on the first white balance parameter and the 3rd white balance, intermediate white balance parameter, base are obtainedCurrent white balance parameter is determined in intermediate white balance parameter and the second white balance parameter.
That is, terminal uses default flash of light upper limit threshold and default flash of light lower threshold as boundary, higher than default sudden strain of a muscleWhen light upper limit threshold, it is possible to which, directly using the second white balance parameter, during less than default flash of light lower threshold, characterization is notIt opens flash lamp and main sudden strain of a muscle pattern rises and dominates, and between default flash of light upper limit threshold and default flash of light lower threshold, just need toConsider the effect of Three models.
Optionally, the default flash of light upper limit threshold in the embodiment of the present invention can be 1000, and presetting flash of light lower threshold canThink 500, default flash of light upper limit threshold and the definite of numerical value of default flash of light lower threshold here can be obtained by experimental data,It can also be determined according to actual conditions, the embodiment of the present invention is not restricted.
Detailed, based on the first white balance parameter and the 3rd white balance parameter, the process for obtaining intermediate white balance parameter canThink:Obtain current environment brightness value;When current environment brightness value is more than default ambient brightness upper limit value, by the 3rd white balanceParameter is as intermediate white balance parameter;When current environment brightness value is less than default ambient brightness lower limiting value, by the first white balanceParameter is as intermediate white balance parameter;When current environment brightness value is on default ambient brightness lower limiting value and default ambient brightnessWhen between limit value, the first white balance parameter and the 3rd white balance parameter are weighted to obtain intermediate white balance parameter.
That is, in embodiments of the present invention, terminal considers influence of the current environment brightness to white balance parameter, eventuallyEnd uses the white balance parameter that default ambient brightness upper limit value and default ambient brightness lower limiting value use at this time for boundary judgement, highWhen default ambient brightness upper limit value, characterization environment is very bright, flash lamp may be opened, accordingly, it is possible to directly adoptWith the 3rd white balance parameter, during less than default ambient brightness lower limiting value, characterization does not open flash lamp, is joined using the 100th balanceNumber, and between default ambient brightness upper limit value and default ambient brightness lower limiting value, it is necessary to consideration do not open flash lamp andThe common effect of main sudden strain of a muscle pattern weights the first white balance parameter and the 3rd white balance parameter to obtain intermediate white balance ginsengNumber.
Optionally, the default ambient brightness upper limit value in the embodiment of the present invention can be 5, and presetting ambient brightness lower limiting value canThink 1, default ambient brightness upper limit value and the definite of the numerical value of default ambient brightness lower limiting value here can be obtained by experimental dataIt arrives, can also be determined according to actual conditions, the embodiment of the present invention is not restricted.
In embodiments of the present invention, terminal determines current white balance based on intermediate white balance parameter and the second white balance parameterThe process of parameter can be:Intermediate white balance parameter and the weighting of the second white balance parameter are determined into current white balance parameter.
S106, the captured image collected is handled using current white balance parameter.
Terminal again captured image when, it is the quantity based on preflashing effective pixel points, the first white balance parameter, second whiteBalance parameters and the 3rd white balance parameter, after determining that current white balance parameter determines current white balance parameter, it is possible to adoptThe captured image collected is handled with current white balance parameter.
Illustratively, as shown in figure 9, the effect of the captured image 1 obtained using existing image procossing is not over thisThe good of the captured image 2 handled in the case of environment and exposal model is considered in application.
It is understood that since terminal can be based on Three models (not opening flash lamp, preflashing and main sudden strain of a muscle) corresponding threeGroup white balance parameter, to do the processing of different white balance parameters, so as to dynamically adjust current white balance parameter so that profitWith the Quality advance for the captured image that current white balance parameter is handled, and then the true of the color of image of captured image is improvedDegree.
Further, as shown in Figure 10, image processing method provided in an embodiment of the present invention further includes before S101:S107 and S108 and after S106, image processing method provided in an embodiment of the present invention further includes:S109.It is as follows:
S107, preflashing function open command is received.
S108, response preset function open command, open preflashing function.
Before preflashing is carried out, terminal can realize the startup of preflashing function by the operation with user, i.e. terminal can be withThe preflashing function open command of user's triggering terminal function generation is received, so terminal can respond the preset function and openInstruction is opened, opens preflashing function.
Captured image after S109, display processing.
Terminal is after using the captured image that collects of current white balance parameter processing, the shooting that just obtained that treatedImage, then, terminal can show shooting treated captured image.
It is understood that the shade and quality for the captured image that terminal is so shown is better.
Embodiment two
Under same inventive concept based on embodiment one, as shown in figure 11, an embodiment of the present invention provides a kind of terminal 1,The terminal 1 can include:
Processor 10, storage medium 11, receiver 12, image pick-up device 13, display 14 and communication bus 15, the receptionDevice 12, the storage medium 11, the image pick-up device 13 and the display 14 pass through the communication bus 15 and the processor10 connection communications;The processor 10 is used to perform the image processing program stored in the storage medium 11, as follows to realizeStep:
When preflashing function is opened, the first white balance parameter is obtained, first white balance parameter is not open flash lampWhen obtain;Preflashing is carried out to target object, the preflashing image of the target object and pre- is gathered by the image pick-up device 13The reference white balance parameter of reference point is dodged, and obtains second white balance parameter;According to the preflashing reference point, determine describedThe quantity of preflashing effective pixel points in preflashing image;The shooting instruction for opening flash lamp, response are received by the receiver 12The shooting instruction obtains the 3rd white balance parameter;Quantity based on the preflashing effective pixel points, first white balance ginsengSeveral, described second white balance parameter and the 3rd white balance parameter, determine current white balance parameter;Using described current white flatThe captured image that weighing apparatus parameter processing is collected by the image pick-up device 13.
Optionally, the processor 10 is more than specifically for the quantity for working as the preflashing effective pixel points in default flash of lightWhen limiting threshold value, second white balance parameter is determined as the current white balance parameter;When the preflashing effective pixel pointsWhen quantity is less than default flash of light lower threshold, based on first white balance parameter and the 3rd white balance parameter, in obtainingBetween white balance parameter, the intermediate white balance parameter is determined as the current white balance parameter;When the preflashing valid pixelIt is white flat based on described first when the quantity of point is between the default flash of light lower threshold and the default flash of light upper limit thresholdThe parameter that weighs and the 3rd white balance, obtain intermediate white balance parameter, based on the intermediate white balance parameter and described second in vainBalance parameters determine the current white balance parameter.
Optionally, the processor 10, also particularly useful for acquisition current environment brightness value;When the current environment brightness valueDuring more than default ambient brightness upper limit value, using the 3rd white balance parameter as the intermediate white balance parameter;Work as when describedWhen preceding ambient brightness value is less than default ambient brightness lower limiting value, join first white balance parameter as the intermediate white balanceNumber;When the current environment brightness value is between the default ambient brightness lower limiting value and the default ambient brightness upper limit valueWhen, first white balance parameter and the 3rd white balance parameter are weighted to obtain the intermediate white balance parameter.
Optionally, the processor 10 is joined also particularly useful for by the intermediate white balance parameter and second white balanceNumber weighting determines the current white balance parameter.
Optionally, the processor 10, specifically for according to the preflashing reference point, obtaining the preflashing of the preflashing imageEffective pixel points;Based on the preflashing effective pixel points and the preflashing reference point, the weight of preflashing effective pixel points is determined;It obtainsTake the preflashing available point white balance parameter of preflashing effective pixel points;According to the preflashing available point white balance parameter and the preflashingThe weight of effective pixel points obtains second white balance parameter.
Optionally, the processor 10, specifically for according to the main sudden strain of a muscle reference point, obtaining the main sudden strain of a muscle of the captured imageEffective pixel points;Based on the main sudden strain of a muscle effective pixel points and the main sudden strain of a muscle reference point, the main weight for dodging effective pixel points is determined;It obtainsTake the main sudden strain of a muscle available point white balance parameter of main sudden strain of a muscle effective pixel points;According to the main sudden strain of a muscle available point white balance parameter and the main sudden strain of a muscleThe weight of effective pixel points obtains the 3rd white balance parameter.
Optionally, the display 14 passes through the image pick-up device for described using the current white balance parameter processingAfter 13 captured images collected, the captured image that treated described in display.
Optionally, the receiver 12 is additionally operable to before the first white balance parameter of the acquisition, is received preflashing function and is openedInstruction;
The processor 10 is additionally operable to respond the preset function open command, opens the preflashing function.
It should be noted that in embodiments of the present invention, processor 10 can be consistent with the processor 110 in Fig. 1, and storage is situated betweenMatter 11 can be consistent with the memory 109 in Fig. 1, and image pick-up device 13 can be corresponding with the interface unit 108 in Fig. 1, and receiver 12 can be withRadio frequency unit 101 in Fig. 1 corresponds to, and display 14 can be corresponding with the display unit 106 in Fig. 1.
It should be noted that during practical application, the various components in terminal are coupled by communication bus 15.It can manageSolution, communication bus 15 are used to implement the connection communication between these components.Communication bus 15 also wraps in addition to including data/address busInclude power bus, controlling bus and status signal bus in addition.But for the sake of clear explanation, various buses are all marked in fig. 11For communication bus 15.
Above-mentioned processor can be application-specific IC (Application Specific IntegratedCircuit, ASIC), digital signal processor (Digital Signal Processor, DSP), digital signal processing device(Digital Signal Processing Device, DSPD), programmable logic device (Programmable LogicDevice, PLD), field programmable gate array (Field Programmable Gate Array, FPGA), central processing unitAt least one of (Central Processing Unit, CPU), controller, microcontroller, microprocessor.It is appreciated thatGround, for different equipment, it can also be other to be used to implement the electronic device of above-mentioned processor function, and the embodiment of the present invention is notMake specific limit.
It is understood that since terminal can be based on Three models (not opening flash lamp, preflashing and main sudden strain of a muscle) corresponding threeGroup white balance parameter, to do the processing of different white balance parameters, so as to dynamically adjust current white balance parameter so that profitWith the Quality advance for the captured image that current white balance parameter is handled, and then the true of the color of image of captured image is improvedDegree.
An embodiment of the present invention provides a kind of computer storage media, there are one the computer-readable recording medium storagesOr multiple images processing routine, one or more of programs can be performed by one or more processor, to realize such asMethod described in embodiment one.
In practical applications, above-mentioned storage medium can be volatile memory (volatile memory), such as withMachine access memory (Random-Access Memory, RAM);Or nonvolatile memory (non-volatileMemory), such as read-only memory (Read-Only Memory, ROM), flash memory (flash memory), hard disk(Hard Disk Drive, HDD) or solid state disk (Solid-State Drive, SSD);Or the memory of mentioned kindCombination, and provide instruction and data to processor.
It should be understood by those skilled in the art that, the embodiment of the present invention can be provided as method, system or computer programProduct.Therefore, the shape of the embodiment in terms of hardware embodiment, software implementation or combination software and hardware can be used in the present inventionFormula.Moreover, the present invention can be used can use storage in one or more computers for wherein including computer usable program codeThe form for the computer program product that medium is implemented on (including but not limited to magnetic disk storage and optical memory etc.).
The present invention be with reference to according to the method for the embodiment of the present invention, the flow of equipment (system) and computer program productFigure and/or block diagram describe.It should be understood that it can be realized by computer program instructions every first-class in flowchart and/or the block diagramThe combination of flow and/or box in journey and/or box and flowchart and/or the block diagram.These computer programs can be providedThe processor of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices is instructed to produceA raw machine so that the instruction performed by computer or the processor of other programmable data processing devices is generated for realThe device for the function of being specified in present one flow of flow chart or one box of multiple flows and/or block diagram or multiple boxes.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spyDetermine in the computer-readable memory that mode works so that the instruction generation being stored in the computer-readable memory includes referring toMake the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one box of block diagram orThe function of being specified in multiple boxes.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that countedSeries of operation steps is performed on calculation machine or other programmable devices to generate computer implemented processing, so as in computer orThe instruction offer performed on other programmable devices is used to implement in one flow of flow chart or multiple flows and/or block diagram oneThe step of function of being specified in a box or multiple boxes.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the scope of the present invention.