The content of the invention
Embodiments of the invention provide a kind of sunshine scene recognition method and device, it is possible to increase the identification essence of sunshine scene
Degree.
To reach above-mentioned purpose, embodiments of the invention are adopted the following technical scheme that:
On the one hand there is provided a kind of sunshine scene recognition method, including:
Gather image;
The view data of described image and the metadata of described image are obtained, and according to described image data and described image
Metadata detection described image in position of sun;
The scene characteristic of the position of sun is extracted in described image, by the scene characteristic of the position of sun and in advance
The scene characteristic of the position of sun of storage is matched, and generates scene Recognition result.
In the first possible implementation, with reference in a first aspect, the scene characteristic by the position of sun with
Before the scene characteristic of the position of sun prestored is matched, in addition to:
According to sample scene capturing sample image;
The scene characteristic of position of sun is extracted in the sample image, and is stored as the position of sun prestored
Scene characteristic.
It is described by the position of sun with reference to the first possible implementation in second of possible implementation
Scene characteristic matched with the scene characteristic of the position of sun prestored, generate scene Recognition result, including:
The scene characteristic of the position of sun is matched with the scene characteristic of the position of sun prestored, will be described
Corresponding to the scene characteristic matched in the scene characteristic of the position of sun prestored with the scene characteristic of the position of sun
The sample scene is used as the scene Recognition result.
In the third possible implementation, with reference in a first aspect, the view data for obtaining described image and institute
The metadata of image is stated, and position of sun in described image, bag are detected according to the metadata of described image data and described image
Include:
View data and First Kind Graph picture that picture signal processing obtains described image are carried out to the described image collected
Metadata;
The Equations of The Second Kind image metadata of described image is obtained by aspect sensor;
Solar direction judgement is carried out according to the First Kind Graph pel data and the Equations of The Second Kind image metadata;
When solar direction is preset in the First Kind Graph pel data and Equations of The Second Kind image metadata matching, according to institute
State position of sun described in Equations of The Second Kind image metadata and described image Data Detection.
It is described according to the Equations of The Second Kind with reference to second of possible implementation in the 4th kind of possible implementation
Position of sun described in image metadata and described image Data Detection, including:
The sun is obtained according to the Equations of The Second Kind image metadata and rises or falls reference direction of the direction in described image;
Described image is divided into wide subgraph according to described image data according to the reference direction;
The mean luminance differences of the adjacent subgraph are calculated, two adjacent subgraph mean luminance differences are more than
The location determination of two subgraphs of predetermined threshold value is the position of sun.
In the 5th kind of possible implementation, with reference to any one possible realization side in first aspect or first aspect
Formula, the scene characteristic that the position of sun is extracted in described image includes:
Calculate in described image and to be risen or fallen in the sun on direction at the position of sun described in the image of both sides
Scene characteristic, the scene characteristic includes First Kind Graph pel data and Equations of The Second Kind image metadata.
In the 6th kind of possible implementation, with reference to the third in first aspect, the 4th kind or the 5th kind of possible realization
Any one possible implementation in mode, the First Kind Graph pel data includes:The color of described image, resolution
Rate, brightness, white balance, the image acquisition time of described image or time for exposure;
The Equations of The Second Kind image metadata includes:Pass through gravity or magnetic force or image perception during collection described image
The bearing data of acquisition.
Second aspect there is provided a kind of sunshine scene identifying device, including:
Image acquisition units, for gathering image;
Image identification unit, view data and the figure for obtaining the described image that described image collecting unit is gathered
The metadata of picture, and the position of sun in described image is detected according to the metadata of described image data and described image;And
The scene characteristic of the position of sun is extracted in described image, by the scene characteristic of the position of sun and the sun prestored
The scene characteristic of position is matched, and generates scene Recognition result.
In the first possible implementation, with reference to second aspect, specifically include:
Described image collecting unit is additionally operable to, according to sample scene capturing sample image;
Described image recognition unit is additionally operable to extract the scene characteristic of position of sun in the sample image, and is stored as
The scene characteristic of the position of sun prestored.
In second of possible implementation, with reference to the first possible implementation, described image recognition unit tool
Body is used to be matched the scene characteristic of the position of sun with the scene characteristic of the position of sun prestored, will be described pre-
Institute corresponding to the scene characteristic matched in the scene characteristic of the position of sun first stored with the scene characteristic of the position of sun
Sample scene is stated as the scene Recognition result.
In the third possible implementation, with reference to second aspect, described image recognition unit includes:
Image procossing subelement, the described image for being collected to described image collecting unit carries out picture signal processing
Obtain the view data and First Kind Graph pel data of described image;
Detection sub-unit, the Equations of The Second Kind image metadata for obtaining described image by aspect sensor;
Just subelement is sentenced, for handling First Kind Graph pel data or the detection that subelement is obtained according to described image
The Equations of The Second Kind image metadata that subelement is obtained carries out solar direction judgement;
Position detection sub-unit, the First Kind Graph pel data and described second are judged for sentencing subelement at the beginning of described
During the default solar direction of class image metadata matching, the Equations of The Second Kind image metadata that is obtained according to the detection sub-unit and described
Position of sun in the described image Data Detection described image that image procossing subelement is obtained.
In possible implementation in the 4th, with reference to the third possible implementation, the position detection sub-unit
Including:
Reference direction acquisition module, exists for rising or falling direction according to the Equations of The Second Kind image metadata acquisition sun
Reference direction in described image;
Figure splits module, for the reference direction that is determined according to the reference direction acquisition module by described image
It is divided into wide subgraph;
Position computation module, for calculating the average bright of the adjacent subgraph that described image segmentation module segmentation goes out
Degree is poor, and it is described that two adjacent subgraph mean luminance differences are more than to the location determination of two subgraphs of predetermined threshold value
Position of sun.
In five kinds of possible implementations, with reference to any one possible realization side in second aspect or second aspect
Formula, described image recognition unit is specifically additionally operable to:Calculate in described image the sun rise or fall on direction it is described too
The scene characteristic of both sides image at positive position, the scene characteristic includes First Kind Graph pel data and Equations of The Second Kind image primitive
Data.
Sunshine scene recognition method and device that embodiments of the invention are provided, by by first number of view data and image
According to knot merga pass once match the identification that judging process realizes scene, effectively improve sunrise sunset scene identification essence
Degree.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based on
Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under the premise of creative work is not made
Embodiment, belongs to the scope of protection of the invention.
A kind of sunshine scene identifying device of embodiments of the invention shown in reference picture 1, the device be specifically as follows camera,
Camera module on video camera, mobile phone or palm PC, specifically, the device includes:
Image acquisition units 11, for gathering image.
Image identification unit 12, view data and first number of image for obtaining the image that image acquisition units 11 are gathered
According to, and the position of sun in view data and the metadata detection image of image;And position of sun is extracted in the picture
Scene characteristic, the scene characteristic of position of sun is matched with the scene characteristic of the position of sun prestored, generates scene
Recognition result.
Optionally, image acquisition units 11 are additionally operable to, according to sample scene capturing sample image.
Image identification unit 12 is additionally operable to, and the scene characteristic of position of sun is extracted in sample image, and is stored as in advance
The scene characteristic of the position of sun of storage;Wherein, image identification unit 12 is specifically for by the scene characteristic of position of sun and in advance
The scene characteristic of the position of sun first stored is matched, by the scene characteristic of the position of sun prestored with position of sun
Scene characteristic matching scene characteristic corresponding to sample scene be used as scene Recognition result.
So sunshine scene identifying device can first carry out the sun in image according to view data and the metadata of image
The detection of position, then the scene of the position of sun according to the scene characteristic of the position of sun prestored to being extracted in image is special
Levying progress, once matching (judging process) can obtain unique scene Recognition result, it is to avoid the generation of misjudgment phenomenon.
The sunshine scene identifying device that embodiments of the invention are provided, passes through the knot in view data and the metadata of image
Merga pass once matches the identification that judging process realizes scene, effectively improves the accuracy of identification of sunrise sunset scene.
Shown in reference picture 2,3, by taking the mobile phone for the sunshine scene identifying device that application embodiments of the invention are provided as an example, i.e.,
Illustrated by taking the mobile phone for possessing camera function as an example, the sunshine scene identifying device includes:
Image acquisition units 21, for gathering image;The specific image acquisition units can use mirror as shown in Figure 2
Head 21a and imaging sensor 21b, wherein imaging sensor 21b are generally divided into CCD for converting optical signals into electric signal
(Charge-coupled Device, charge coupled cell) and CMOS (Complementary Metal Oxide
Semiconductor, complementary metal oxide semiconductor) two major classes, imaging sensor 21b pass through camera lens 21a gather image;Tool
The image acquisition units 21 of body are additionally operable to according to sample scene capturing sample image, and its process is identical with image acquisition process no longer
Repeat.
Image identification unit 22, view data and first number of image for obtaining the image that image acquisition units 21 are gathered
According to, and the position of sun in view data and the metadata detection image of image;And position of sun is extracted in the picture
Scene characteristic, the scene characteristic of position of sun is matched with the scene characteristic of the position of sun prestored, generates scene
Recognition result.
The specific image identification unit 22 can include image-signal processor 22a, sensing processor 22b and identification is calculated
Method processor 22c, wherein image-signal processor 22a as image identification unit 22 image procossing subelement 221 be used for pair
The image that image acquisition units 21 are collected carries out the view data and First Kind Graph pixel number that picture signal processing obtains image
According to, the picture signal of the imaging sensor 21b outputs specifically for handling front end, the color of progress bad point detection acquisition image,
The first kind metadata such as resolution ratio, brightness, white balance, image acquisition time or time for exposure.
Sensing processor 22b is used for the Equations of The Second Kind that described image is obtained by aspect sensor as detection sub-unit 222
Image metadata;Certainly sensing directional implement body here can include:Gravity sensor, magnetometric sensor or image sensing
Device, waits the sensor judged as orientation, when obtaining direction as aspect sensor using imaging sensor, can directly adopt
With the recognition result of image acquisition units 21.
Recognizer processor 22c, which is used to realize, just sentences subelement 223 and position detection sub-unit 224, wherein just sentencing son
Unit 223, what First Kind Graph pel data or detection sub-unit 222 for being obtained according to image procossing subelement 221 were obtained
Equations of The Second Kind image metadata carries out solar direction judgement;Position detection sub-unit 224, was judged for sentencing subelement 223 originally
When one class image metadata and the default solar direction of Equations of The Second Kind image metadata matching, the obtained according to detection sub-unit 222
Position of sun in the view data detection image that two class image metadatas and image procossing subelement 221 are obtained.
The position detection sub-unit 224 includes:
Reference direction acquisition module 2241, for obtaining the sun side of rising or falling according to the Equations of The Second Kind image metadata
To the reference direction in described image.
Figure splits module 2242, for the reference side determined according to view data according to reference direction acquisition module 2241
To dividing an image into wide subgraph.
Position computation module 2243, for calculating the average bright of the adjacent subgraph that image segmentation module 2243 is partitioned into
Degree is poor, and the location determination for two subgraphs that two adjacent sub- mean picture brightness differences are more than into predetermined threshold value is sun position
Put.
Image identification unit 22 is calculated by recognizer processor 22c and risen or fallen in image in the sun on direction too
The scene characteristic of both sides image at positive position, scene characteristic includes First Kind Graph pel data and Equations of The Second Kind image metadata.
Certainly, image identification unit 22 is additionally operable to extract the scene characteristic of position of sun in sample image, and is stored as
The scene characteristic of the position of sun prestored;The process is calculated with image identification unit 22 by recognizer processor 22c
The method of the scene characteristic of image is identical, and the scene characteristic that position of sun is simply extracted in sample image can consider sun position
It is one position of sun of known i.e. each sample scene correspondence to put.Finally, image identification unit 12 is handled by recognizer
Device 22c is matched the scene characteristic of position of sun with the scene characteristic of the position of sun prestored, by what is prestored
Sample scene corresponding to the scene characteristic matched in the scene characteristic of position of sun with the scene characteristic of position of sun is as field
Scape recognition result.
So, sunshine scene identifying device can according to view data and the metadata of image (be specially the first image with
Data and the second image metadata) (specific detection process is calculated referring to above-mentioned identification for the detection of position of sun that first carries out in image
Method processor 22c concrete processing procedure), then according to the scene characteristic of position of sun that prestores to being extracted in image
The scene characteristic of position of sun carries out once matching (judging process) is that can obtain unique scene Recognition result, it is to avoid erroneous judgement
The generation of phenomenon.
During certainly by taking mobile phone as an example, the mobile phone can also include back-end image processor 23 and display 24 and image storage
Device 25, wherein, back-end image processor 23 increases according to the scene Recognition result of recognizer processor to the image of input
By force, comprising denoising, contrast enhancing is sharpened, stored after color treatments to image processor 25, user can pass through display 23
Image is checked, or is transferred to network, PC (personal computer, personal computer) machine etc..
Based on existing smart mobile phone function, in apparatus above embodiment, the function of each processor, which is realized, can pass through hand
Machine CPU (Central Processing Unit, central processing unit) carries out overall control, user can by touch-screen or
The sunshine scene identifying device that the form of button realizes man-machine interaction to control embodiments of the invention to be provided.
The function performed by sunshine scene identifying device that embodiments of the invention described above are provided can be by a processor
Perform, here is omitted.
The sunshine scene identifying device that embodiments of the invention are provided, passes through the knot in view data and the metadata of image
Merga pass once matches the identification that judging process realizes scene, effectively improves the accuracy of identification of sunrise sunset scene.
The sunshine scene recognition method that embodiments of the invention are provided can be applied to camera, mobile phone, palm PC etc.
Electronic equipment, specifically, shown in reference picture 4, the sunshine scene recognition method includes:
301st, image is gathered.
302nd, the view data of image and the metadata of image are obtained, and is detected according to view data and the metadata of image
Position of sun in image.
303rd, the scene characteristic of position of sun is extracted in the picture, by the scene characteristic of position of sun with prestoring too
The scene characteristic of positive position is matched, and generates scene Recognition result.
So, the detection of the position of sun in image can be first carried out according to view data and the metadata of image, then
The scene characteristic of position of sun according to the scene characteristic of the position of sun prestored to being extracted in image is once matched
(judging process) be that can obtain unique scene Recognition result, it is to avoid the generation of misjudgment phenomenon.
The sunshine scene recognition method that embodiments of the invention are provided, passes through the knot in view data and the metadata of image
Merga pass once matches the identification that judging process realizes scene, effectively improves the accuracy of identification of sunrise sunset scene.
Shown in reference picture 4, embodiments of the invention provide a kind of recognition methods of sunshine scene, including:
401st, image is gathered.
402nd, view data and First Kind Graph pixel number that picture signal processing obtains image are carried out to the image collected
According to.
403rd, the Equations of The Second Kind image metadata of image is obtained by aspect sensor.
Wherein, First Kind Graph pel data includes:The color of image, resolution ratio, brightness, white balance, the image of image are adopted
Collection time or time for exposure;Equations of The Second Kind image metadata includes:Pass through gravity or magnetic force or image perception in collection image process
The bearing data of acquisition.
404th, solar direction judgement is carried out according to First Kind Graph pel data and Equations of The Second Kind image metadata.
405th, when solar direction is preset in First Kind Graph pel data and the matching of Equations of The Second Kind image metadata, according to Equations of The Second Kind
Image metadata and view data detection position of sun.
Shown in reference picture 5, position of sun is detected according to Equations of The Second Kind image metadata and view data in step 405, specifically
Including:
405a, according to Equations of The Second Kind image metadata obtain the sun rise or fall the reference direction of direction in the picture.
Here Equations of The Second Kind metadata is the bearing data obtained by gravity or magnetic force or image perception, it is of course possible to used
The aspect sensors such as gravity, magnetic force or imaging sensor are obtained.
405b, wide subgraph is divided an image into according to reference direction.
405c, the mean luminance differences for calculating adjacent subgraph, two adjacent sub- mean picture brightness differences are more than pre-
If the location determination of two subgraphs of threshold value is position of sun.
406th, the scene characteristic for rising or falling both sides image at position of sun on direction in image in the sun is calculated, will too
The scene characteristic of positive position is matched with the scene characteristic of the position of sun prestored, generates scene Recognition result.
The scene characteristic includes First Kind Graph pel data and Equations of The Second Kind image metadata.
Wherein according to step 405 by the scene characteristic of the position of sun and the scene characteristic of position of sun prestored
Before being matched, in addition to:
401a, according to sample scene capturing sample image.
402a, the scene characteristic for extracting in sample image position of sun, and the position of sun for being stored as prestoring
Scene characteristic.
Wherein, the scene characteristic of position of sun and the scene characteristic of the position of sun prestored are carried out in step 406
Matching, generates scene Recognition result, is specially:
The scene characteristic of position of sun is matched with the scene characteristic of the position of sun prestored, will be prestored
Position of sun scene characteristic in sample scene conduct corresponding to the scene characteristic that is matched with the scene characteristic of position of sun
Scene Recognition result.
So, according to view data and the metadata of image (being specially the first image and data and the second image metadata)
The detection (specific detection process embodiment shown in Figure 5) of the position of sun in image is first carried out, then basis is deposited in advance
The scene characteristic of position of sun of the scene characteristic of the position of sun of storage to being extracted in image carries out once matching (judging process)
It can obtain unique scene Recognition result, it is to avoid the generation of misjudgment phenomenon.
The sunshine scene recognition method that embodiments of the invention are provided, passes through the knot in view data and the metadata of image
Merga pass once matches the identification that judging process realizes scene, effectively improves the accuracy of identification of sunrise sunset scene.
Specifically by taking mobile phone photograph as an example, reference picture 3 is illustrated, and user opens the image capture software on mobile phone, such as
Camera function etc., light is projected on imaging sensor 21b by camera lens 21a, and imaging sensor 21b converts light signals into electricity
Signal formation view data, view data passes through image-signal processor 22a processing, goes out to be schemed in back-end image processor 23
Display 24 is shown to after image intensifying algorithm process, at this moment user sees preview screen of taking pictures.
Meanwhile, the view data of user's preview enters recognizer processor 22c through image-signal processor 22a processing,
Recognizer processor 22c obtains metadata from mobile phone sensing processor 22b and image-signal processor 22a, by member
The analysis of data and view data, produce current scene whether recognition result, and send the scene information of identification to figure
As signal processor 22a and back-end image processor 23, image-signal processor 22a and back-end image processor 23 are according to identification
Scene information intelligence selection parameter, so as to realize for preview and the optimization for effect of taking pictures under selected sunshine scene.Such as,
Under sunrise/sunset scene, image-signal processor 22a can adjust AWB, and (Automatic white balance are put down in vain automatically
Weighing apparatus) scope of statistics, suitably increase red gain.Back-end image processor 23 lifts image overall contrast, appropriate enhancing figure
As saturation degree so that sunset/sunrise scene is more splendid.
By taking sunset/sunrise scene Recognition as an example, specific embodiments of the invention provide processing procedure as described below, this
The sunshine scene recognizer of embodiment analyzes preview image of taking pictures, and generally 30 frames are per second, whole sunset/sunrise scene Recognition
Algorithm is divided into training (as shown in step 401a and 402a in Fig. 2) and recognizes the two large divisions (as shown in 401-406 in Fig. 2).Instruction
Practice part by the study to a large amount of sunsets/sunrise sample, generate the disaggregated model for recognizing sunset/sunrise scene, the portion
Divide it is considered that position of sun is known, and does not need equipment automatic identification.Identification division for input image, according to figure
As the result extraction feature of the aspect sensor processing on signal processor 22a, mobile phone, and by the feature of extraction with training part
Sunset/sunrise scene classification model carry out matching judgement.Recognizer processor 22c, which is extracted, can reflect that sunset/day appears on the scene
The characteristics of image of scape feature, these features include image YUV (a kind of colour coding method) average and variance, image top and the bottom
The mean luminance differences divided, inclined red pixel ratio, the time for exposure, gravity sensor value, photo opporunity etc., and according to machine learning
Method analyze a large amount of training samples, generate the disaggregated model for detecting sunset/sunrise scene.Wherein machine learning method is
Can be SVM (support vector machine SVMs).Recognizer processor 22c combination sensing processors
22b information, calculates mobile phone towards ground, towards day, towards information such as all directions, and sensing processor 22b can use gravity here
One kind or multiple combination in sensor, magnetometric sensor, imaging sensor calculate the direction of mobile phone.Recognizer processor
The first kind metadata such as the photo opporunity that 22c combination image-signal processors 22a is obtained and mobile phone orientation information refusal fall that
A little is not the scene of sunset/sunrise, for example, scene of the mobile phone towards ground or towards day is not sunset/sunrise scene;Photo opporunity
(i.e. image acquisition time) in the morning 3 points to 9 points and mobile phone towards east, or photo opporunity in the afternoon 3 points at 9 points in evening and hand
Machine is likely to be sunset/sunrise scene towards the scene in west.Sun position in recognizer processor 22c detection images to be recognized
Put.In typical sunset scene, sun above section image is substantially bright in the sun once parts of images, moreover, red pixel partially
Big focus mostly on is appeared in sun above section image.Detect after position of sun, characteristic extracting module is calculated on position of sun
Square image and the sun lower images mean luminance differences, and the ratio of inclined red pixel in sun upper images is calculated, count simultaneously
Calculate partially blue, the partially green and partially red pixel ratio of position of sun lower images.For non-sunset scene, it can generally also examine
A false position of sun is measured, but the characteristics of image extracted according to this position of sun can not meet top and become clear, it is partially red,
The upper part or the specific orientation of lower part of the sun in the feature on lower section very dark and color saturation ground, certain above example
It is that reference direction is used as using the direction reflection that rises or falls of the sun in the picture.
Wherein, mobile phone direction is judged according to aspect sensor, is specifically as follows and mobile phone screen is judged according to gravity sensor
Reverses direction, setting (gX, gY, g Z) is value of the gravity sensor in (x, y, z) direction, then setting mobile phone screen overturns 0 degree
Direction be microphone below receiver, at this moment the value of gravity sensor is that gX is approximately equal to zero, and gY is much larger than 0;Set mobile phone screen
It is microphone on the right side of receiver to turn over and turn 90 degrees direction, and at this moment the value of gravity sensor is that gY is approximately equal to 0, and gX is much larger than 0;Set hand
Machine screen turning turnback direction be microphone above receiver, at this moment the value of gravity sensor is that gX is approximately equal to 0, and gX is much smaller than
0;It is microphone on the left of receiver to set mobile phone screen and overturn 270 degree directions, and at this moment the value of gravity sensor is approximately equal to 0 for gY, and
GX is much smaller than 0.The photographer's face walking direction mobile phone screen reverses direction that can certainly be detected according to front camera,
Now aspect sensor may be considered an imaging sensor, it is assumed that photographer, which is vertical head, shoots sunset/day
Go out scene, if the face eyes line detected is perpendicular to mobile phone microphone receiver line, and face is in microphone direction, then
The mobile phone screen of correspondence setting overturns 0 degree of direction, naturally it is also possible to set mobile phone reverses direction according to using gravity sensor
Principle sets other reference directions.
Finally for the detection of position of sun, after reference direction determination, it will be inputted according to mobile phone screen reverses direction
Image is divided into the subgraph slice parallel to horizontal fixed width, and the direction from horizon to day calculates adjacent sub-images successively
The mean luminance differences of bar, position of sun is calculated according to adjacent sub-images mean luminance differences, and position of sun refers to from horizon here
To the corresponding image coordinate of the upward sun of old name for the Arabian countries in the Middle East, if the mean luminance differences of adjacent sub-images are more than given threshold value, then the sun
Position is exactly this boundary position to subgraph bar;Or the mean luminance differences of all adjacent sub-images bars are calculated, correspondence is maximum
The boundary position of the adjacent sub-images bar of mean luminance differences is the position of sun detected;Or the calculating time of correspondence position of sun
Go through from horizon to all possible positions in sky direction so that the maximum position of above image and image lower section mean luminance differences is just
It is the position of sun detected.Then recognizer processor 22c extracts sunset/sunrise scene characteristic, with the classification trained
Model Matching, formed whether be sunset/sunrise scene judgement.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any
Those familiar with the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be contained
Cover within protection scope of the present invention.Therefore, protection scope of the present invention described should be defined by scope of the claims.