A kind of brightness of image method of adjustment, terminal and computer-readable recording mediumTechnical field
The present invention relates to communication technical field, more particularly to a kind of brightness of image method of adjustment, terminal and computer-readableStorage medium.
Background technology
With the fast development of the communication technology, terminal increasingly develops to intelligentized direction, such as current smart mobile phoneOr tablet personal computer, its function is also more and more, and the mobile communication terminal is not the simple mutually interconnection for being used for meeting people alreadySystem, more as highly important mobile personal recreation terminal in people's daily life.
At present, camera function has turned into the essential function of intelligent terminal, and people can record excellent anywhere or anytimeMoment.When being shot, in the environment of backlight, the brightness that face is presented will be also dark more than background.If conversely, lightSource direct irradiation is when face, and the brightness that face is presented will be also bright more than background.And when the brightness on face is substantially partially brightOr it is substantially partially dark, may result in the feature of face because of overexposure or under-exposure makes the image deprivation phase of faceThe feature of pass.
The content of the invention
In view of this, the embodiment of the present invention is expected to provide a kind of brightness of image method of adjustment, terminal and computer-readable depositedStorage media, solves in prior art face overexposure in shooting process or under-exposed and make the image of faceThe problem of losing correlated characteristic, realizes and carries out brightness adjustment to image based on Face datection, so as to avoid human face region mistakeDegree exposure is under-exposed, and then improves the quality of image.
To reach above-mentioned purpose, the technical proposal of the invention is realized in this way:
In a first aspect, the embodiment of the present invention provides a kind of brightness of image method of adjustment, methods described includes:
It is determined that the first average brightness and the second average brightness of the image collected, wherein, first brightness is put downAverage is the average brightness of whole image, and second average brightness is that the brightness of human face region in described image is averagedValue;
The 3rd brightness for determining described image according to first average brightness and second average brightness is averagedValue;
The brightness adjustment value of described image is determined according to the 3rd average brightness;
Brightness according to the brightness adjustment value to the whole image is adjusted.
Second aspect, the embodiment of the present invention provides a kind of terminal, and the terminal at least includes:Camera, processor, storageDevice and communication bus, wherein:
The camera, for gathering image;
The communication bus, for realizing the connection communication between processor and memory;
The memory, for storage image brightness adjustment program;
The processor, the brightness of image adjustment programme stored for performing in memory, to realize following steps:
It is determined that the first average brightness and the second average brightness of the image collected, wherein, first brightness is put downAverage is the average brightness of whole image, and second average brightness is that the brightness of human face region in described image is averagedValue;
The 3rd brightness for determining described image according to first average brightness and second average brightness is averagedValue;
The brightness adjustment value of described image is determined according to the 3rd average brightness;
Brightness according to the brightness adjustment value to the whole image is adjusted.
The third aspect, the embodiment of the present invention provides a kind of computer-readable recording medium, the computer-readable storage mediumThe brightness of image that is stored with matter adjustment programme, described image brightness adjustment program realizes that above-mentioned image is bright when being executed by processorThe step of spending method of adjustment.
A kind of brightness of image method of adjustment, terminal and computer-readable recording medium that embodiments of the invention are provided,Wherein, it is first determined the first average brightness and the second average brightness of the image collected, wherein, first brightness put downAverage is the average brightness of whole image, and second average brightness is that the brightness of human face region in described image is averagedValue;Then the 3rd brightness for determining described image according to first average brightness and second average brightness is averagedValue;The brightness adjustment value of described image is determined further according to the 3rd average brightness;Finally according to the brightness adjustment value pairThe brightness of the whole image is adjusted, in this way, when carrying out face shooting, can be according to the average brightness of whole imageBrightness with the average brightness of human face region to image is adjusted, so as to avoid human face region overexposure or expose notFoot, and then improve the quality of shooting image.
Brief description of the drawings
Fig. 1 is a kind of hardware architecture diagram for the mobile terminal for realizing each embodiment of the 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 implementation process schematic diagram of brightness of image method of adjustment provided in an embodiment of the present invention;
Fig. 4 is the implementation process schematic diagram of another brightness of image method of adjustment provided in an embodiment of the present invention;
Fig. 5 is the interface schematic diagram for the image that terminal camera of the embodiment of the present invention is collected;
Fig. 6 is the interface schematic diagram that terminal of the embodiment of the present invention exports prompt message;
Fig. 7 is that the embodiment of the present invention carries out the image schematic diagram after brightness adjustment;
Fig. 8 is a kind of composition structural representation of terminal provided in an embodiment of the present invention.
Embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
In follow-up description, the suffix using such as " module ", " part " or " unit " for representing element is onlyBe conducive to the explanation of the present invention, itself there is no a specific meaning.Therefore, " module ", " part " or " unit " can be mixedGround is used.
Terminal can be implemented in a variety of manners.For example, the terminal described in the present invention can include such as mobile phone, flat boardComputer, notebook computer, palm PC, personal digital assistant (Personal Digital Assistant, PDA), portableMedia player (Portable Media Player, PMP), guider, wearable device, Intelligent bracelet, pedometer etc. are movedMove the fixed terminals such as terminal, and numeral 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 specialOutside element for moving purpose, construction according to the embodiment of the present invention can also apply to the terminal of fixed type.
Referring to Fig. 1, its hardware architecture diagram for a kind of mobile terminal of realization each embodiment of the invention, the shiftingDynamic terminal 100 can include:RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit103rd, A/V (audio/video) input block 104, sensor 105, display unit 106, user input unit 107, interface unit108th, the part such as memory 109, processor 110 and power supply 111.It will be understood by those skilled in the art that shown in Fig. 1Mobile terminal structure does not constitute the restriction to mobile terminal, and mobile terminal can be included than illustrating more or less parts,Either combine some parts or different parts 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, the reception and transmission of signal, specifically, by base stationDownlink information receive after, handled to processor 110;In addition, up data are sent into base station.Generally, radio frequency unit 101Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier, duplexer etc..In addition, penetratingFrequency unit 101 can also be communicated by radio communication with network and other equipment.Above-mentioned radio communication can use any communicationStandard or agreement, including 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, WCDMA), TD-SCDMA (Time Division-Synchronous CodeDivision Multiple Access, TD SDMA), FDD-LTE (Frequency DivisionDuplexing-Long Term Evolution, FDD Long Term Evolution) and TDD-LTE (Time DivisionDuplexing-Long Term Evolution, time division duplex Long Term Evolution) etc..
WiFi belongs to short range wireless transmission technology, and mobile terminal can help user's transmitting-receiving electricity by WiFi module 102Sub- mail, browse webpage and access streaming video etc., it has provided the user wireless broadband internet and accessed.Although Fig. 1 showsGo out WiFi module 102, but it is understood that, it is simultaneously not belonging to must be configured into for mobile terminal, completely can be according to needTo be omitted in the essential scope for do not change invention.
Audio output unit 103 can be in call signal reception pattern, call mode, record mould in mobile terminal 1 00When under the isotypes such as formula, speech recognition mode, broadcast reception mode, it is that radio frequency unit 101 or WiFi module 102 are received orThe voice data stored in memory 109 is converted into audio signal and is output as sound.Moreover, audio output unit 103The audio output related to the specific function that mobile terminal 1 00 is performed can also be provided (for example, call signal receives sound, disappearedBreath receives sound etc.).Audio output unit 103 can include loudspeaker, buzzer etc..
A/V input blocks 104 are used to receive audio or video signal.A/V input blocks 104 can include graphics processor(Graphics Processing Unit, GPU) 1041 and microphone 1042,1041 pairs of graphics processor is in video acquisition modeOr the view data progress of the static images or video obtained in image capture mode by image capture apparatus (such as camera)Reason.Picture frame after processing may be displayed on display unit 106.Picture frame after being handled through graphics processor 1041 can be depositedStorage is transmitted in memory 109 (or other storage mediums) or via radio frequency unit 101 or WiFi module 102.MikeWind 1042 can connect in telephone calling model, logging mode, speech recognition mode etc. operational mode via microphone 1042Quiet down sound (voice data), and can be voice data by such acoustic processing.Audio (voice) data after processing canTo be converted to the form output that mobile communication base station can be sent to via radio frequency unit 101 in the case of telephone calling model.Microphone 1042 can implement various types of noises and eliminate (or suppression) algorithm to eliminate (or suppression) in reception and send soundThe noise produced during frequency signal or interference.
Mobile terminal 1 00 also includes at least one sensor 105, such as optical sensor, motion sensor and other biographiesSensor.Specifically, optical sensor includes ambient light sensor and proximity transducer, wherein, ambient light sensor can be according to environmentThe light and shade of light adjusts the brightness of display panel 1061, and proximity transducer can close when mobile terminal 1 00 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 axles) 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, will not be repeated here.
Display unit 106 is used for the information for showing the information inputted by user or being supplied to user.Display unit 106 can be wrappedDisplay panel 1061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be usedForms such as (Organic Light-Emitting Diode, OLED) configures display panel 1061.
User input unit 107 can be used for the numeral or character information for receiving input, and produce the use with mobile terminalThe key signals input that family is set and function control is relevant.Specifically, user input unit 107 may include contact panel 1071 withAnd other input equipments 1072.Contact panel 1071, also referred to as touch-screen, collect touch operation of the user on or near it(such as user is using any suitable objects such as finger, stylus or annex on contact panel 1071 or in contact panel 1071Neighbouring operation), and corresponding attachment means are driven according to formula set in advance.Contact panel 1071 may include touch detectionTwo parts of device and touch controller.Wherein, touch detecting apparatus detects the touch orientation of user, and detects touch operation bandThe signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by itIt is converted into contact coordinate, then gives processor 110, and the order sent of reception processing device 110 and can be performed.In addition, canTo realize contact panel 1071 using polytypes such as resistance-type, condenser type, infrared ray and surface acoustic waves.Except contact panel1071, user input unit 107 can also include other input equipments 1072.Specifically, other input equipments 1072 can be wrappedInclude but be not limited to physical keyboard, in function key (such as volume control button, switch key etc.), trace ball, mouse, action bars etc.One or more, do not limit herein specifically.
Further, contact panel 1071 can cover display panel 1061, detect thereon when contact panel 1071 orAfter neighbouring touch operation, processor 110 is sent to determine the type of touch event, with preprocessor 110 according to touch thingThe type of part provides corresponding visual output on display panel 1061.Although in Fig. 1, contact panel 1071 and display panel1061 be input and the output function that mobile terminal is realized as two independent parts, but in certain embodiments, canBy contact panel 1071 and the input that is integrated and realizing mobile terminal of display panel 1061 and output function, not do specifically hereinLimit.
Interface unit 108 is connected the interface that can pass through as at least one external device (ED) with mobile terminal 1 00.For example,External device (ED) can include wired or wireless head-band earphone port, external power source (or battery charger) port, wired or nothingLine FPDP, memory card port, the port for connecting the device 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 1 00 or can be withFor transmitting data between mobile terminal 1 00 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, application program (the such as sound that storing program area can be needed for storage program area, at least one functionSound playing function, image player function etc.) etc.;Storage data field can be stored uses created data (such as according to mobile phoneVoice data, phone directory etc.) etc..In addition, memory 109 can include high-speed random access memory, it can also include non-easyThe property lost memory, for example, at least one 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 whole mobile terminal of connectionIndividual part, by operation or performs and is stored in software program and/or module in memory 109, and calls and be stored in storageData in device 109, perform the various functions and processing data of mobile terminal, so as to carry out integral monitoring to mobile terminal.PlaceReason device 110 may include one or more processing units;It is preferred that, processor 110 can integrated application processor and modulatedemodulate mediateDevice is managed, wherein, application processor mainly handles operating system, user interface and application program etc., and modem processor is mainHandle radio communication.It is understood that above-mentioned modem processor can not also be integrated into processor 110.
Mobile terminal 1 00 can also include the power supply 111 (such as battery) powered to all parts, 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 function such as electricity and power managed.
Although Fig. 1 is not shown, mobile terminal 1 00 can also will not be repeated here including bluetooth module etc..
For the ease of understanding the embodiment of the present invention, the communications network system that the mobile terminal of the present invention is based on is entered belowRow 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 systemUnite 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 here is omitted.
E-UTRAN202 includes eNodeB 2021 and other eNodeB 2022 etc..Wherein, eNodeB2 021 can pass throughBackhaul (backhaul) (such as X2 interface) is connected with other eNodeB 2022, and eNodeB 2021 is connected to EPC203,ENodeB 2021 can provide UE201 to EPC203 access.
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 andThere is provided carrying and connection management for the control node of signaling between EPC203.HSS2032 is all to manage for providing some registersSuch as function of attaching position register (not shown) etc, and some are preserved about the use such as service features, data rateThe special information in family.All customer data can be transmitted by SGW2034, and PGW2035 can provide UE 201 IPAddress is distributed and other functions, and PCRF2036 is strategy and the charging control strategic decision-making of business data flow and IP bearing resourcesPoint, it selects and provided 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., do not limit herein.Based on above-mentioned mobile terminal hardware configuration and communications network system, carryGo out the inventive method each embodiment.
Embodiment one
The embodiment of the present invention provides a kind of brightness of image method of adjustment, and Fig. 3 is a kind of image provided in an embodiment of the present inventionThe implementation process schematic diagram of luminance regulating method, as shown in figure 3, the described method comprises the following steps:
Step S301, it is determined that the first average brightness and the second average brightness of the image collected.
Here, step S301 determine the first average brightness of image and the second average brightness that collect can be byTerminal is realized, it is possible to further be mobile terminal, for example, can be mobile phone (mobile phone), iPad, notebook, wearWearing formula intelligent watch etc. has the mobile terminal of wireless communication ability, and the mobile terminal at least includes camera and display screenCurtain, the same face that the camera can be with plane where the display screen of terminal, can also be located at and the terminal display screenThe opposite face of plane where curtain.
The brightness of image, refers to the intensity of image pixel, and black is most dark, and white is most bright, and black is represented with 0,White is represented with 255.One pixel, substantially carrys out table with three color components of RGB (Red Green Blue, RGB)The R (0-255) shown, G (0-255), B (0-255).This brightness and form and aspect are that not related, same brightness both can beRed can also be green, and the same just as the image in black and white (gray scale) television set, not can determine that only according to a gray scale isRed or green.So, the brightness of pixel and form and aspect are unrelated.
First average brightness is the average brightness of whole image, and second average brightness is described imageThe average brightness of middle human face region.In actual implementation process, for gray level image, determine that first average brightness canTo be realized by the way that the brightness value of each pixel in whole image is carried out into geometric average or weighted average, correspondingly,Determine that the second average brightness of gray level image can be by by each pixel of the human face region in the gray level imageBrightness value carries out geometric average or weighted average to realize.And for coloured image, determine that first average brightness value is firstIt is first hue saturation brightness (Hue Saturation Lightness, HSL) spatial moment by the rgb space matrix conversion of imageBattle array, the L * component of wherein HSL space matrixs represents brightness, is then determined according to the L * component of described image;Similarly, it is determined that describedIt is HSL space matrixs that second average brightness, which is needed first by the rgb space matrix conversion of the human face region in described image, soThe L * component in the HSL matrixes is determined afterwards.
And the L * component in HSL matrixes determines that the average brightness of image can be realized by two ways:
First way:Average (mean) computing twice is carried out to the L * component of described image, you can obtain described imageAverage brightness;
The second way:L * component in described image is changed to log space to the log space brightness for calculating described imageAverage value;The log space average brightness of described image is subjected to antilogarithm calculating, the average brightness of described image is obtained.
Certainly, the method for the above-mentioned average brightness of calculating image first and the second average brightness is exemplary illustration,Those skilled in the art using the present invention technological thought, proposed according to its real needs itself it is determined that image it is first brightThe mode for spending average value and the second average brightness is within the scope of the present invention, herein without exhaustive one by one.
Step S302, the 3rd of described image is determined according to first average brightness and second average brightnessAverage brightness.
Here, the step S302 determines the figure according to first average brightness and second average brightness3rd average brightness of picture can be realized by terminal.3rd average brightness can be understood as the mixed of described imageClose average brightness.First average brightness and second average brightness are namely subjected to certain computing, obtainedTo the 3rd average brightness of described image.
In other embodiments of the present invention, the step S302 is according to first average brightness and second brightnessAverage value determines that the 3rd average brightness of described image can be realized by following steps:
Step S3021, current environment brightness value is determined according to first average brightness;
Step S3022, the first weights are determined according to the current environment brightness value;
Step S3023, is determined according to first average brightness, second average brightness and first weights3rd average brightness of described image.
It is described to be determined to work as according to first average brightness in above-mentioned steps S3021 to step S3023 embodimentPreceding ambient brightness value can be realized by inquiring about the mapping table of default ambient brightness value and average brightness.For example,First average brightness is 300 every square metre of candela (cd/m2) when, the corresponding lux of ambient brightness value 350 (lux);TheOne average brightness is 150cd/m2When, corresponding ambient brightness value is 100lux.The ambient brightness value and average brightnessMapping table can in advance be set by the production firm of terminal, be for user generally it is invisible,And can not be modified by user.
It is described to determine that current ambient brightness value calculate public by default according to first average brightnessFormula determines that the formula is also to be set in advance by the production firm of terminal, and same invisible for user,It can not be modified by user.
It is described that first weights are determined according to the current environment brightness value, can be by inquiring about default ambient brightness andThe mapping table of one weights is realized, it is necessary to illustrate, in the mapping table of the ambient brightness and the first weights,Ambient brightness can be a span, for example, corresponding first power of the ambient brightness value between 200lux-300luxIt is worth for 0.8, corresponding first weights of ambient brightness value less than 200lux are 0.7, the ambient brightness value correspondence more than 300luxThe first weights be 0.9.
First weights are the corresponding weighted values of the second average brightness of human face region, for the decimal less than 1, alsoIt is to say, if current environment brightness value is higher, such as in the sunny daylight environment of outdoor weather, is calculating the 3rd of imageDuring average brightness, the weight ratio shared by the second average brightness of human face region is relatively low in current context value, such as at nightEnvironment in human face region the second average brightness shared by weight it is high.During due to being taken pictures under the environment of strong light, peopleThe average brightness of average brightness (the second average brightness) often than other regions in face region is low, is now calculatingDuring mixed brightness average value (the 3rd average brightness) of image, assign the average brightness of human face region higher weights, canTo be considered as the average brightness for reducing background area, and then the mixed brightness average value of image can be caused closer and faceThe average brightness in region, so as to avoid human face region under-exposed.And when being taken pictures in the environment of half-light, human face regionAverage brightness of the average brightness often than background area it is high, now calculating the mixed brightness average value of imageWhen, assign the average brightness of human face region relatively low weights, the average brightness for reducing human face region can be considered as, so thatAvoid human face region overexposure.
Step S303, the brightness adjustment value of described image is determined according to the 3rd average brightness.
Here, the step S303 determines that the brightness adjustment value of described image can be according to the 3rd average brightnessRealized by terminal.
In other embodiments of the present invention, the step S303 determines described image according to the 3rd average brightnessBrightness adjustment value can be realized by following steps:
Step S3031, obtains the first preset value and the second preset value;
Step S3032, the common logarithm value of first preset value and the ratio of the 3rd average brightness is determinedFor pre-adjustment value;
Step S3033, the brightness that the product of the pre-adjustment value and second preset value is defined as described image is adjustedWhole value.
In the step S3031 to step S3033 embodiment, first preset value is a target brightness value,First preset value can just be set by the production firm of terminal before terminal is dispatched from the factory, and first preset value also may be usedTo provide user the interface of modification by terminal, modified by user according to oneself hobby or demand, but the modification of userValue should terminal production firm set in the range of, if the modified values of user not within the range when can change failure, andPoint out user modification scope.
Second preset value can be a constant, it is understood that to be a coefficient, second preset value isJust set before terminal is dispatched from the factory by the production firm of terminal, be generally invisible to user, and can not be by userModification.
Step S304, the brightness according to the brightness adjustment value to the whole image is adjusted.
Here, brightness of the step S304 according to the brightness adjustment value to the whole image, which is adjusted, to beRealized by terminal.
In other embodiments of the present invention, the step S304 according to the brightness adjustment value to the bright of the whole imageDegree is adjusted and can realized by following steps:
Step S3041, determines the initial luma values of each pixel in described image;
Step S3042, according to the initial luma values of each pixel in the brightness adjustment value and described image, it is determined that describedThe target brightness value of each pixel in image;
Step S3043, according to the target brightness value of each pixel in described image to each pixel in described imageBrightness is adjusted.
A kind of brightness of image method of adjustment that embodiments of the invention are provided, it is first determined the first of the image collected is brightAverage value and the second average brightness are spent, wherein, first average brightness is the average brightness of whole image, described theTwo average brightness are the average brightness of human face region in described image;Then according to first average brightness and describedSecond average brightness determines the 3rd average brightness of described image;The figure is determined further according to the 3rd average brightnessThe brightness adjustment value of picture;Brightness finally according to the brightness adjustment value to the whole image is adjusted, in this way, carrying outWhen face is shot, brightness that can be according to the average brightness of whole image and the average brightness of human face region to image is carried outAdjustment, so as to avoid human face region overexposure or under-exposure, and then improves the quality of shooting image.
Embodiment two
Based on foregoing embodiment, the embodiment of the present invention provides a kind of brightness of image method of adjustment again, applied to terminal, shouldTerminal at least includes camera, and Fig. 4 shows for the implementation process of another brightness of image method of adjustment provided in an embodiment of the present inventionIt is intended to, as shown in figure 4, the described method comprises the following steps:
Step S401, terminal obtains the operational order that user starts camera applications.
Here, in the present embodiment, user can start camera applications in several ways, for example:Can be by clicking onThe camera applications icon for stating terminal starts camera applications, can also be realized by pressing the touch operation region of terminal side, i.e.,The operational order that terminal obtains user's startup camera applications includes:What the default touch operation region of acquisition terminal side was receivedTouch operation, and determine the corresponding control instruction of touch operation;When control instruction is starts camera applications, starting camera shouldWith.Also camera applications can be started by voice and gesture etc. in addition.The triggering side of the startup camera applications listed above enumeratedWhat formula was merely exemplary, those skilled in the art using the present invention technological thought, proposed according to its real needs itsThe triggering mode that it starts camera applications is within the scope of the present invention, herein without exhaustive one by one.
Step S402, the terminal is based on the operation start instruction camera;
Here, the camera can be that front camera can also be rear camera.Such as, each camera applications are openedCan be that acquiescence starts rear camera when dynamic.Can also start the camera used during the closing of camera applications last time.
Terminal starts after the camera, and into the shooting preview interface of terminal, user can in shooting preview interfaceTo carry out preview to the image captured by the camera.In the terminal, camera can be that standard camera head, wide-angle are taken the photographAs head, focal length camera and black and white shooting are first-class.
In other embodiments of the present invention, when terminal includes multiple cameras, such as front camera has two, rearmountedCamera has two, and the type of two front cameras can be identical or different.Such as two preposition shootingsHead is all standard camera head, or a front camera is standard camera head, and another front camera is black and white camera.Similarly, the type of two rear cameras can be identical or different.Such as, two rear cameras are allIt is standard camera head, or, a rear camera is wide-angle camera, and another rear camera is focal length camera.
Step S403, preview image described in the terminal-pair carries out Face datection, judges to whether there is people in described imageFace region.
Here, if there is human face region in described image into step S404;If face is not present in described imageThen terminate flow in region.
In embodiments of the present invention, described in the terminal-pair preview image carry out Face datection, judge be in described imageNo have human face region can be that, according to multiple face characteristics, whether detection image has a human face region.Wherein, face characteristicRelatively to have the region of feature, such as eyes, eyebrow, nose or face etc. in common people face.During perform detection flow, you can utilizeThese features find out the Gradient direction information between feature, and are used as by the use of this Gradient direction information the foundation of detection.In addition,Also can be according to the foundation as detection such as features such as profile, the shape of face.These face characteristics can be hundreds of or thousands ofBar, this image is people after the characteristic filter of these this hundreds of or thousands of, meeting the regions of these featuresFace region.Again or, the distance of eyes can also be obtained first using face is detected based on the method for eyes distance, then takeThe midpoint of eyes distance, the mathematical operation of point coordinates and eyes distance is come locating human face in.
In addition, the method for carrying out Face datection can also be the method for elastic graph matching, based on artificial neural networkMethod, method based on SVMs etc., the method for the progress Face datection listed above enumerated is merely exemplary, those skilled in the art utilize the technological thought of the present invention, the side of the other Face datections proposed according to its real needsMethod is within the scope of the present invention, herein without exhaustive one by one.
Step S404, the terminal determines the first average brightness and the second average brightness of described image.
Here, first average brightness is the average brightness of the whole image;Second average brightnessFor the average brightness of human face region.
Step S405, the terminal judges the exhausted of the difference of first average brightness and second average brightnessWhether the 3rd preset value is more than to value.
Here, if the absolute value of the difference of first average brightness and second average brightness is more than the 3rdPreset value, then illustrate the difference mistake of the second average brightness of the human face region and the average brightness of the whole imageGreatly, overexposure or under-exposure can be caused, now into step S406;If first average brightness and describedThe absolute value of the difference of two average brightness is less than or equal to the 3rd preset value, then illustrates the second brightness of the human face regionThe difference of average value and the average brightness of the whole image within the acceptable range, need not now carry out brightness tuneIt is whole, terminate flow.
Fig. 5 is the interface schematic diagram for the image that terminal camera of the embodiment of the present invention is collected, as shown in figure 5,501 regionsFor the human face region detected, because under half-light environment, the brightness of human face region is very high, overexposure can be so caused.
Step S406, the terminal exports prompt message, and judges whether to receive the carry out brightness of image that user sendsThe instruction of adjustment.
Here, the prompt message is used to prompt the user whether to carry out brightness of image adjustment.Fig. 6 is that the embodiment of the present invention is wholeThe interface schematic diagram of end output prompt message, as shown in fig. 6, when the difference mistake of the first average brightness and the second average brightnessWhen big, the terminal can export the prompt message shown in 601 on screen, and judge whether to receive the progress that user sends and schemeThe instruction of image brightness adjustment.In actual implementation process, think to have received user's hair if user clicks "Yes" buttonThe instruction of the carry out brightness of image adjustment gone out;If user clicks "No" button or other areas in addition to "Yes" buttonDomain, then it is assumed that be not received by the instruction for the carry out brightness of image adjustment that user sends.
In other embodiments, it is also provided with carrying out the switch of brightness of image adjustment in the terminal, user can be withThe state of the switch is set in advance, when the difference of the first average brightness and the second average brightness is excessive, the endEnd judges whether the state of the switch is out, if the state of the switch is opens, into step S407;If described openThe state of pass then generates " human face region overexposure or under-exposure in present image, if open brightness adjustment and open to closeClose ", and further determine whether that receiving user opens the instruction of brightness adjusting switch, opened if receiving unlatching brightness adjustmentThe instruction of pass, then into step S407;If being not received by the instruction for opening brightness adjusting switch, flow is received.
Step S407, the terminal determines current environment brightness value according to first average brightness.
Here, it is described to determine that current ambient brightness value be default by inquiring about according to first average brightnessThe mapping table of ambient brightness value and average brightness is realized.
Step S408, the terminal determines the first weights according to the current environment brightness value.
Here, it is described that first weights are determined according to the current environment brightness value, can be bright by inquiring about default environmentDegree realizes that table 1 is the mapping table of ambient brightness and the first weights, as shown in table 1 with the mapping table of the first weights,In the mapping table of the ambient brightness and the first weights, ambient brightness can be a span.
The mapping table of table 1, ambient brightness and the first weights
| Ambient brightness value | First weights |
| 0~200lux | 0.7 |
| 200~300lux | 0.8 |
| 300lux~∞ | 0.9 |
Step S409, the terminal is according to first average brightness, second average brightness and described firstWeights determine the 3rd average brightness of described image.
Here, the step S409 can be realized by following steps:First weights and second brightness are put downThe product of average is defined as the first mixed number;Difference and first average brightness that first weights are obtained are subtracted by 1Product be defined as the second mixed number;By first mixed number and second mixed number and being defined as described image theThree average brightness.
In actual implementation process, the 3rd average brightness of described image can be determined according to formula (1-1):
Metered_luma=face_weight*face_luma+ (1-face_weight) * cur_luma (1-1);
Wherein, in formula (1-1), metered_luma is the 3rd average brightness, and face_weight is the first powerValue, face_luma is the second average brightness, and cur_luma is the first average brightness.
Step S410, the brightness adjustment value of described image is determined according to the 3rd average brightness.
Here, the step S410 can be realized by following steps:Obtain the first preset value and the second preset value;By instituteThe common logarithm value for stating the ratio of the first preset value and the 3rd average brightness is defined as pre-adjustment value;By the pre-adjustmentValue and the product of second preset value are defined as the brightness adjustment value of described image.
In actual implementation process, the brightness adjustment value of described image can be determined according to formula (1-2).
Wherein, in the formula (1-2), luma_offset is brightness adjustment value, and luma_target is first defaultValue, lg () is common logarithm function.
Step S411, the brightness according to the brightness adjustment value to the whole image is adjusted.
Image after the brightness adjustment will be turned into RGB color by step S412, the terminal by HSL color space conversionsSpace, and export the image after the brightness adjustment.
Fig. 7 is that the embodiment of the present invention carries out the image schematic diagram after brightness adjustment, as shown in fig. 7, carry out after brightness adjustment,The brightness value of human face region 701 is substantially reduced, and this avoid overexposure.
In brightness of image method of adjustment provided in an embodiment of the present invention, terminal is according to the operation start instruction of user firstCamera applications, and camera collection image is controlled, on the premise of then there is human face region in described image, determine the figureThe first average brightness and the second average brightness of picture, and it is true according to first average brightness and the second average brightnessDetermine the 3rd average brightness of described image, and then brightness adjustment value is determined according to the 3rd average brightness, finally according toThe brightness adjustment value carries out brightness adjustment to described image, due to it is determined that during three brightness values, according to the ring of different shootingsThe first different weights are determined in border brightness, so can be reduced in different environment or be increased the brightness of human face region, fromAnd overexposure or under-exposure are avoided, improve the quality of shooting image.
Example IV
The embodiment of the present invention provides a kind of terminal, and Fig. 8 shows for a kind of composition structure of terminal provided in an embodiment of the present inventionIt is intended to, as shown in figure 8, the terminal 800 at least includes:Processor 801, memory 802, communication bus 803 and camera804, wherein:
The processor 801, the brightness of image adjustment programme stored for performing in memory, to realize following steps:
It is determined that the first average brightness and the second average brightness of the image collected, wherein, first brightness is put downAverage is the average brightness of whole image, and second average brightness is that the brightness of human face region in described image is averagedValue;
The 3rd brightness for determining described image according to first average brightness and second average brightness is averagedValue;
The brightness adjustment value of described image is determined according to the 3rd average brightness;
Brightness according to the brightness adjustment value to the whole image is adjusted.
In other embodiments of the present invention, the first average brightness in the image for determining to collect and the second brightnessBefore the step of average value, the processor 801 is additionally operable to perform the brightness of image adjustment programme stored in memory, with realityExisting following steps:
Face datection is carried out to described image, judges to whether there is human face region in described image, wherein, if the figureThere is the first average brightness and the second average brightness for the image that human face region determination is collected as in.
In other embodiments of the present invention, it is described true according to first average brightness and second average brightnessDetermine the 3rd average brightness of described image, including:
Current environment brightness value is determined according to first average brightness;
First weights are determined according to the current environment brightness value;
Described image is determined according to first average brightness, second average brightness and first weights3rd average brightness.
In other embodiments of the present invention, it is described according to first average brightness, second average brightness andFirst weights determine the 3rd average brightness of described image, including:
The product of first weights and second average brightness is defined as the first mixed number;
The difference that first weights obtain is subtracted by 1 be defined as second with the product of first average brightness mixValue;
By the 3rd average brightness that is first mixed number and second mixed number and being defined as described image.
In other embodiments of the present invention, the brightness adjustment that described image is determined according to the 3rd average brightnessValue, including:
Obtain the first preset value and the second preset value;
The common logarithm value of first preset value and the ratio of the 3rd average brightness is defined as pre-adjustment value;
The product of the pre-adjustment value and second preset value is defined as to the brightness adjustment value of described image.
In other embodiments of the present invention, the brightness according to the brightness adjustment value to the whole image is adjustedIt is whole, including:
Determine the initial luma values of each pixel in described image;
According to the initial luma values of each pixel in the brightness adjustment value and described image, determine each in described imageThe target brightness value of pixel;
Brightness according to the target brightness value of each pixel in described image to each pixel in described image is adjustedIt is whole.
The memory 802, for storage image brightness adjustment program;
The communication bus 803, for realizing the connection communication between processor and memory;
The camera 804, for gathering image.
Embodiment five
The embodiment of the present invention provides a kind of computer-readable recording medium, and the computer-readable recording medium storage has oneIndividual or multiple programs, one or more of programs can be by one or more computing device, to realize following steps:
It is determined that the first average brightness and the second average brightness of the image collected, wherein, first brightness is put downAverage is the average brightness of whole image, and second average brightness is that the brightness of human face region in described image is averagedValue;
The 3rd brightness for determining described image according to first average brightness and second average brightness is averagedValue;
The brightness adjustment value of described image is determined according to the 3rd average brightness;
Brightness according to the brightness adjustment value to the whole image is adjusted.
It should be noted that one or more program in the embodiment of the present invention can be when carrying out brightness of image adjustmentThe brightness of image adjustment programme of use.
It should be noted that herein, term " comprising ", "comprising" or its any other variant are intended to non-rowHis property is included, so that process, method, article or device including a series of key elements not only include those key elements, andAnd also including other key elements being not expressly set out, or also include for this process, method, article or device institute inherentlyKey element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including thisAlso there is other identical element in process, method, article or the device of key element.
The embodiments of the present invention are for illustration only, and the quality of embodiment is not represented.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment sideMethod can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many casesThe former is more preferably embodiment.Understood based on such, technical scheme is substantially done to prior art in other wordsGoing out the part of contribution can be embodied in the form of software product, and the computer software product is stored in a storage mediumIn (such as ROM/RAM, magnetic disc, CD), including some instructions are to cause a station terminal equipment (can be mobile phone, computer, clothesIt is engaged in device, air conditioner, or network equipment etc.) perform method described by each embodiment of the invention.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program productFigure and/or block diagram are described.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagramJourney and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.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 produced by the instruction of computer or the computing device of other programmable data processing devices for realThe device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively 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 being stored in the computer-readable memory, which is produced, to be included referring toMake the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram orThe function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that in meterSeries of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, thus in computer orThe instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram oneThe step of function of being specified in individual square frame or multiple square frames.
The preferred embodiments of the present invention are these are only, are not intended to limit the scope of the invention, it is every to utilize this hairEquivalent structure or equivalent flow conversion that bright specification and accompanying drawing content are made, or directly or indirectly it is used in other related skillsArt field, is included within the scope of the present invention.