A kind of method, device and mobile terminal of differentiation image front and back scene area
Technical field
The present embodiments relate to field of photographing technology more particularly to a kind of methods for distinguishing image front and back scene area, dress
It sets and mobile terminal.
Background technique
Currently, camera has become the standard configuration of big multi-mobile-terminal, with the continuous promotion of camera performance, move
Camera function in dynamic terminal is also stronger and stronger, and the user to like taking pictures brings convenience.
In shooting process, in order to highlight shooting main body, it is clear that prospect (shooting main body) is taken using shooting skill
The clear and photo with Deep Canvas that background (background) is fuzzy, the shooting skill are particularly suitable for portrait.Now, many
Mobile terminal user likes carrying out self-timer using the front camera on mobile terminal, and it is desirable that obtains above-mentioned with Deep Canvas
Take a picture certainly, and in order to obtain with the photo of Deep Canvas, need to calculate the depth of field to distinguish scenic spot before and after image
Domain is generally realized by laser focusing or dual camera.However, the mobile terminals such as existing mobile phone and tablet computer is hard
Part configuration can not calculate the depth of field, so prospect and background cannot be distinguished when shooting, thus cannot shoot with Deep Canvas
Take a picture certainly.Taking a picture certainly with Deep Canvas in order to obtain, user can only shoot the photo of averaging effect, and in the later period
Depth of field processing is carried out to image, it is complicated for operation, it makes troubles for mobile terminal user.
Summary of the invention
The purpose of the embodiment of the present invention is that a kind of method, device and mobile terminal of differentiation image front and back scene area are provided,
Front and back scene area cannot be distinguished to solve the problems, such as mobile terminal camera when shooting photo.
In a first aspect, the embodiment of the invention provides a kind of methods of scene area before and after differentiation image, comprising:
When monitoring that distinguishing image front and back scene area event is triggered, control screen carries out light filling;
Control camera captures image during screen light filling;
Obtain the brightness data of described image;
Region division is carried out to described image according to the brightness data, and is closed according to the height between the brightness in each region
It is to determine foreground area and background region.
Second aspect, the embodiment of the invention provides a kind of devices of scene area before and after differentiation image, comprising:
Light filling control module, for when scene area event is triggered before and after monitoring differentiation image, control screen to be carried out
Light filling;
Picture catching control module captures image during screen light filling for controlling camera;
Brightness data obtains module, for obtaining the brightness data of described image;
Region division module, for carrying out region division to described image according to the brightness data;
Front and back scene area determining module determines foreground area with after for the height relationship between the brightness according to each region
Scene area.
The third aspect, the embodiment of the invention provides a kind of mobile terminal, the mobile terminal is integrated with implementation of the present invention
The device for distinguishing image front and back scene area in example.
What is provided in the embodiment of the present invention distinguishes the scheme of image front and back scene area, the scenic spot before and after monitoring differentiation image
When domain event is triggered, control screen carries out light filling and controls camera capture image, according to the brightness data of image to image
Region division is carried out, foreground area and background region are finally determined according to the height relationship between the brightness in each region.By adopting
With above-mentioned technical proposal, different distance when screen light filling can be utilized in the case where not changing the original hardware configuration of mobile terminal
The object difference of the illumination of light that is received distinguish prospect and background, and calculation amount is small, and fast response time facilitates user
Taking a picture certainly with Deep Canvas is shot, the program is particularly suitable for the differentiation in low smooth self-timer scene to front and back scape.
Detailed description of the invention
Fig. 1 is a kind of flow diagram of the method for differentiation image front and back scene area that the embodiment of the present invention one provides;
Fig. 2 is a kind of flow diagram of method for distinguishing image front and back scene area provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of flow diagram of the method for differentiation image front and back scene area that the embodiment of the present invention three provides;
Fig. 4 is a kind of structural block diagram of the device for differentiation image front and back scene area that the embodiment of the present invention four provides.
Specific embodiment
To further illustrate the technical scheme of the present invention below with reference to the accompanying drawings and specific embodiments.It is understood that
It is that specific embodiment described herein is used only for explaining the present invention rather than limiting the invention.It further needs exist for illustrating
, only the parts related to the present invention are shown for ease of description, in attached drawing rather than entire infrastructure.
It should be mentioned that some exemplary embodiments are described as before exemplary embodiment is discussed in greater detail
The processing or method described as flow chart.Although each step is described as the processing of sequence by flow chart, many of these
Step can be implemented concurrently, concomitantly or simultaneously.In addition, the sequence of each step can be rearranged.When its operation
The processing can be terminated when completion, it is also possible to have the additional step being not included in attached drawing.The processing can be with
Corresponding to method, function, regulation, subroutine, subprogram etc..
Embodiment one
Fig. 1 is a kind of flow diagram of the method for differentiation image front and back scene area that the embodiment of the present invention one provides, should
Method can be executed by the device of scene area before and after differentiation image, and wherein the device can be implemented by software and/or hardware, and generally may be used
It integrates in the terminal.As shown in Figure 1, this method comprises:
Step 101 monitors that scene area event is when being triggered before and after distinguishing image, and control screen carries out light filling.
Illustratively, the mobile terminal in the present embodiment concretely match by mobile phone, tablet computer and digital camera etc.
It is equipped with the terminal device of display screen.
Illustratively, monitoring that differentiation image front and back scene area event is triggered specifically can refer to monitor that user passes through key
Etc. scene area event before and after modes active trigger region partial image, for example, the camera in mobile terminal (is concretely fixed on
The positive front camera of mobile terminal, the i.e. front camera ipsilateral with screen;Mobile terminal can also be in for current location
Positive rotatable camera) it is in the open state when, user by presses differentiation front and back scape key active trigger region partial image
Front and back scene area event;Monitoring that differentiation image front and back scene area event is triggered specifically also can refer to monitor that mobile terminal is automatic
Scene area event before and after trigger region partial image for example, the camera in mobile terminal is in the open state, and distinguishes front and back scape
It, can automatic trigger differentiation image front and back scene area event when detecting that user presses camera button under function is in the open state.
Illustratively, control screen, which carries out light filling, specifically can refer to show suitable brightness come for camera by controlling screen
Light filling, that is to say, that rule first is set according to screen intensity and determines screen intensity, then controls screen with identified screen intensity
Carry out light filling.Specific screen intensity setting rule is not construed as limiting, for example, survey light can be carried out by ambient light sensor, and according to
The environmental light brightness for including in photometry result determines the brightness of screen.Preferably, when environmental light brightness is bright lower than default first
When spending threshold value, it can illustrate that current shooting environment is darker, screen intensity can be determined according to default inverse relation, is i.e. ambient brightness is lower
Then screen intensity is higher, the advantages of this arrangement are as follows reasonable light filling can be carried out to object, facilitates subsequent front and back scape
It determines, and there is the photo of Deep Canvas determining front and back Jing Houke and directly generating light filling effect preferably.Further,
It when environmental light brightness is higher than default second luminance threshold, can illustrate that current environment is brighter, can be determined according to default proportional relation
The more high then screen intensity of screen intensity, i.e. ambient brightness is higher, the advantages of this arrangement are as follows, since shooting environmental itself has compared
It is brighter, it is only provided with the higher light filling of brightness and is just easy to distinguish the light situation of the object of different distance, can be improved
Distinguish the accuracy of front and back scape.Wherein, the first luminance threshold and the second luminance threshold may be the same or different, can be free
Setting.
Step 102, control camera capture image during screen light filling.
Illustratively, before the camera in the present embodiment is concretely fixed on mobile terminal positive (ipsilateral with screen)
Camera is set, the positive rotatable camera of mobile terminal can also be in for current location.
Step 103, the brightness data for obtaining image.
Illustratively, the brightness data specifically may include brightness value distribution situation related data, such as picture each in image
The brightness value of element and brightness histogram data etc..
Step 104 carries out region division to image according to brightness data, and is closed according to the height between the brightness in each region
It is to determine foreground area and background region.
Illustratively, during screen light filling, the illumination for the light that the object of different distance is received is different, and
Image is captured during screen light filling, so the brightness case of different location is able to reflect corresponding position in the image
Near-far situation of the corresponding object apart from screen.Under normal conditions, since light in air can be because of the shadow of the factors such as dust
It rings and dissipates, the brightness that the object closer apart from screen (being equivalent to light source) is presented in the picture is higher, and gets over apart from screen
The brightness that remote object is presented in the picture is lower.So can be according to the brightness case of the different location in image to image
Region division is carried out, the higher region of brightness is determined as foreground area, the lower region of brightness is determined as background region, side
Just subsequent applications.
Preferably, region division is carried out to image according to brightness data, specifically can include: according to the brightness in brightness data
Distribution situation related data and default zoning ordinance carry out region division to image.The default zoning ordinance can be according to practical feelings
Condition is adjusted, and the present embodiment is not especially limited.For example, the pixel that brightness value approaches and concentration occurs can be divided to same
Region, that is to say, that for the pixel close for two brightness values, the positional relationship being contemplated that when dividing between pixel,
And whether it is spaced to exist between them and differs other farther away pixels with two pixel brightness values;In settable the same area
The maximum luminance difference of permission, for example, the difference that the highest brightness value for including in the region subtracts minimum brightness value should preset most
In big brightness difference range.
It should be noted that designer can be obtained under fixed mask brightness irradiation by test, same ambient brightness
The object of middle different distance is by the brightness after light filling, and forming brightness, (different screen brightness is corresponding different from the corresponding relationship of distance
Brightness and distance corresponding relationship, varying environment brightness corresponds to the corresponding relationship of different brightness and distance), using above-mentioned bright
The corresponding relationship of degree and distance, so that it may in practical applications according to the anti-distance for releasing distance of the brightness after light filling, design
The corresponding relationship that can refer to above-mentioned brightness and distance when zoning ordinance is designed.For example, when designing zoning ordinance, if want by
Range difference is that two objects of A (such as 20 centimetres) are divided in the same area, referring to the corresponding relationship of above-mentioned brightness and distance,
The luminance difference for two objects that range difference is A is B, then the maximum luminance difference allowed in above-mentioned the same area is settable
For B.
The method of scene area, the scenic spot before and after monitoring differentiation image before and after the differentiation image that the embodiment of the present invention one provides
When domain event is triggered, control screen carries out light filling and controls camera capture image, according to the brightness data of image to image
Region division is carried out, foreground area and background region are finally determined according to the height relationship between the brightness in each region.By adopting
With above-mentioned technical proposal, different distance when screen light filling can be utilized in the case where not changing the original hardware configuration of mobile terminal
The object difference of the illumination of light that is received distinguish prospect and background, and calculation amount is small, and fast response time facilitates user
Taking a picture certainly with Deep Canvas is shot, this method is particularly suitable for the differentiation in low smooth self-timer scene to front and back scape.
Embodiment two
Fig. 2 is a kind of flow diagram of method for distinguishing image front and back scene area provided by Embodiment 2 of the present invention, this
Embodiment is optimized based on above-described embodiment, in the present embodiment, by step " according to the height between the brightness in each region
Low relationship determines foreground area and background region " optimization are as follows: determine the brightness value in each region;According to the height of the brightness value in each region
Low relationship is ranked up each region;The highest region of brightness value is determined as foreground area, remaining area is determined as background
Region.
Correspondingly, the method for the present embodiment includes the following steps:
Step 201 monitors that scene area event is when being triggered before and after distinguishing image, and control screen carries out light filling.
Step 202, control camera capture image during screen light filling.
Step 203, the brightness data for obtaining image carry out region division to image according to brightness data.
Step 204, the brightness value for determining each region.
Illustratively, for each region, the average value of the brightness value of all pixels in current region can be calculated, and with this
Brightness value of the average value as current region.
Step 205 is ranked up each region according to the height relationship of the brightness value in each region.
Illustratively, each region can be ranked up according to the sequence of brightness value from high to low.
The highest region of brightness value is determined as foreground area by step 206.
Preferably, the highest region of brightness value is determined as foreground area, may particularly include: calculating brightness value highest the
The area in one region;Judge whether the area of first area is higher than preset area threshold value, if so, before first area is determined as
Scene area.Further, may also include that if it is not, the area for coming the subsequent region in first area is then sequentially calculated, until calculating
When the area of second area is higher than preset area threshold value out, second area is determined as foreground area.The benefit being arranged in this way exists
In, in self-timer, prospect is generally user's face, and it is possible that the jamming light sources such as street lamp in background, if directly by brightness
Highest region is determined as foreground area it is possible that erroneous judgement situation.For taking pictures certainly, facial image occupied area is logical
It is often larger, and the jamming light sources such as street lamp can be lower than preset area threshold since farther out, occupied area is usually smaller apart from camera
Value, thus can exclusive PCR light source to the interference during front and back scenic spot point, improve accuracy.
Remaining area is determined as background region by step 207.
Preferably, the brightness value forward and area that sorts higher than the region of preset area threshold value is being determined as foreground area
Afterwards, other regions including jamming light source are determined into background region, accurately front and back scape is distinguished.
The method of scene area before and after differentiation image provided by Embodiment 2 of the present invention after the brightness value for determining each region, is pressed
Each region is ranked up according to the height relationship of the brightness value in each region, and the highest region of brightness value is determined as foreground zone
Remaining area is determined as background region by domain, can further before and after lifting zone partial image scene area accuracy.
Embodiment three
Fig. 3 is a kind of flow diagram of the method for differentiation image front and back scene area that the embodiment of the present invention three provides, this
Embodiment is optimized based on above-described embodiment, in the present embodiment, is increased step finally: being made mould to background region
Paste processing, and image generates photo according to treated.
Correspondingly, the method for the present embodiment includes the following steps:
Step 301 monitors that scene area event is when being triggered before and after distinguishing image, and control screen carries out light filling.
Step 302, control camera capture image during screen light filling.
Step 303, the brightness data for obtaining image carry out region division to image according to brightness data.
Step 304, the brightness value for determining each region arrange each region according to the height relationship of the brightness value in each region
Sequence.
Step 305, the area for calculating the highest region of present intensity value.
Illustratively, when executing this step for the first time, in the highest region, that is, above-described embodiment of present intensity value first
Region.
Step 306 judges whether the area in the highest region of present intensity value is higher than preset area threshold value, if it is not, then holding
Row step 307;If so, executing step 308.
Step 307, using region next in sequence as the new highest region of present intensity value, return to step
305。
The highest region of present intensity value is determined as foreground area by step 308, executes step 309.
Remaining area is determined as background region by step 309.
Step 310 makees Fuzzy Processing to background region, and image generates photo according to treated.
Illustratively, Fuzzy Processing is made to background region, retains clearly foreground area, and image carries out to treated
The operations such as coding generate photo, are supplied to user, and photo at this time is to have taking pictures certainly for Deep Canvas, meet user's need
It asks.Wherein, the process for making Fuzzy Processing to background region can refer to existing image fuzzy treatment technology, such as Gaussian Blur processing
Deng the present embodiment is not especially limited.
Preferably, it as described in the embodiment of the present invention one, when environmental light brightness is higher than default second luminance threshold, can press
Screen intensity is determined according to default proportional relation, image at this time can influence effect of taking pictures because over-exposed, in this case,
Foreground area and background region can be recorded, redefine screen intensity, control screen intensity of the screen to redefine
Light filling (or stopping light filling) is carried out, control camera captures the second image, according to the foreground area and background region pair recorded
Second image carries out region division, obtains the foreground area and background region of the second image, and to the rear scenic spot in the second image
Fuzzy Processing is made in domain, and according to treated, the generation of the second image is taken a picture certainly.Self-timer photo lithography at this time is reasonable, effect of taking pictures
Ideal can meet user demand.
The method of scene area, is determining foreground area and rear scenic spot before and after the differentiation image that the embodiment of the present invention three provides
Behind domain, Fuzzy Processing is made to background region, and image generates photo according to treated, user can easily shoot imitates with the depth of field
Fruit is taken a picture certainly, meets user demand, promotes user experience.
Example IV
Fig. 4 is a kind of structural block diagram of the device for differentiation image front and back scene area that the embodiment of the present invention four provides, the dress
Setting can be implemented by software and/or hardware, and be typically integrated in mobile terminal, and the side of image front and back scene area can be distinguished by executing
Method distinguishes scene area before and after image.As shown in figure 4, the device includes light filling control module 401, picture catching control module
402, brightness data obtains module 403, region division module 404 and front and back scene area determining module 405.
Wherein, light filling control module 401, for controlling when scene area event is triggered before and after monitoring differentiation image
Screen carries out light filling;Picture catching control module 402 captures image during the screen light filling for controlling camera;
Brightness data obtains module 403, for obtaining the brightness data of described image;Region division module 404, for according to described bright
Degree carries out region division according to described image;Front and back scene area determining module 405, between the brightness according to each region
Height relationship determines foreground area and background region.
The device of scene area before and after what the embodiment of the present invention four provided distinguish image, can be not change mobile terminal original hard
In the case that part configures, the difference of the illumination of the light received using the object of different distance when screen light filling distinguishes prospect
And background, and calculation amount is small, fast response time, facilitates user to shoot taking a picture certainly with Deep Canvas, the program is especially
Differentiation suitable for low smooth self-timer scene to front and back scape.
On the basis of the above embodiments, the region division module is particularly used in: according in the brightness data
Luminance Distribution situation related data and default zoning ordinance carry out region division to described image.
On the basis of the above embodiments, the front and back scene area determining module may include brightness value determination unit, region
Sequencing unit and front and back scene area determination unit.Wherein, brightness value determination unit, for determining the brightness value in each region;Region
Sequencing unit, the height relationship for the brightness value according to each region are ranked up each region;Front and back scene area
Remaining area is determined as background region for the highest region of brightness value to be determined as foreground area by determination unit.
On the basis of the above embodiments, the front and back scene area determination unit may include areal calculation subelement and prospect
Region determines subelement.Wherein, areal calculation subelement, for calculating the area of the highest first area of brightness value;Foreground zone
Domain determines subelement, for judging whether the area of the first area is higher than preset area threshold value, if so, by described first
Region is determined as foreground area.
On the basis of the above embodiments, the areal calculation subelement, it may also be used for judging the first area
When area is not higher than preset area threshold value, the area for coming the subsequent region in the first area is sequentially calculated, until calculating
The area of second area is higher than the preset area threshold value;The foreground area determines subelement, it may also be used in the area
When the area that computation subunit calculates second area is higher than the preset area threshold value, the second area is determined as prospect
Region.
On the basis of the above embodiments, which may also include that photo generation module, be used for described according to each region
Brightness between height relationship determine foreground area and background region after, Fuzzy Processing, and root are made to the background region
According to treated, image generates photo.
On the basis of the above embodiments, the camera is that front camera or current location are in mobile terminal front
Rotatable camera.
Embodiment five
The embodiment of the present invention five provides a kind of mobile terminal, and mobile terminal is integrated with differentiation provided in an embodiment of the present invention
The device of scene area before and after image can distinguish scene area before and after image by executing the method for differentiation image front and back scene area.
Illustratively, the mobile terminal in the present embodiment concretely match by mobile phone, tablet computer and digital camera etc.
It is equipped with the terminal device of display screen.
When user carries out self-timer using the mobile terminal in the present embodiment, mobile terminal can fast automatic realization front and back scape
Differentiation, and the photo with Deep Canvas can be shot, meet user demand, promote user experience.
The device for distinguishing image front and back scene area and the executable present invention of mobile terminal provided in above-described embodiment is any
The method that image front and back scene area is distinguished provided by embodiment has and executes the corresponding functional module of this method and beneficial to effect
Fruit.The not technical detail of detailed description in the above-described embodiments, reference can be made to differentiation image provided by any embodiment of the invention
The method of front and back scene area.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that
The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation,
It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention
It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also
It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.