Invention content
It is an object of the present invention to provide a kind of background blurring system and method for photo, phase difference carries out image procossing, can be with
It is background blurring to complete photo for the separating treatment of simple and efficient completion background and main body.In order to realize the object of the invention, use
Following technical scheme:
A kind of background blurring system of photo, including:
Image phase detection module detects the phase information of each pixel in whole image, and phase information and image
In each pixel correspond to;
Image separation module, according to the phase information, by each portion consistent with main body segment phase difference in whole image
Divide and be extracted as individual region segment respectively, realizes image separation;Pair of auto-focusing when the main body segment is image taking
As the segment of part;
The region segment is carried out virtualization processing by image blurring module;
And image synthesis unit, each region segment is synthesized to final background blurring photograph with the main body segment
Piece.
The technical program first checks for the phase information of each pixel, later using the phase information of main body segment as comparing
Benchmark, various pieces consistent with main body segment phase difference in whole image are isolated several region segments, later to this
A little regions segment is blurred.The background blurring of entire photo is carried out by this way.
Preferably, each section consistent with main body segment phase difference in whole image is extracted as individual administrative division map respectively
Block, specifically, region each section in whole image is consistent with main body segment phase difference and mutually adjacent is as an area
Domain segment is then several region segments according to phase difference in whole image.
This preferred embodiment provides the specific means of extraction region block, if phase of two pixels relative to main body segment
It is poor consistent, but their distances are very remote, and pixel is obviously discontinuous therebetween, then can not judge in the same segment.
It is fallen into a certain range it is further preferred that the phase difference is unanimously phase difference.
Substantial phase difference is unanimously not offered as phase difference value must be completely the same, but a range.Due to
The specific same scenery or personage itself are unlikely to be a pure plane, phase necessarily range when imaging, and
On-fixed value.As long as therefore system default is exactly a specific content within the scope of this, a region segment is constituted.
It is further preferred that the region segment is subjected to virtualization processing, specifically,
According to the phase difference of each region segment of extraction, virtualization processing is carried out respectively, is connect with the main body segment phase
Close or identical region segment is stronger for the region segment virtualization effect bigger with main body segment phase difference without blurring,
It is weaker for the region segment virtualization effect smaller with main body phase difference.
This preferred embodiment determines the power of virtualization according to phase difference value, there is the effect for highlighting main body.
The present invention also provides a kind of photo background-blurring methods, include the following steps:
S1 detects the phase information of each pixel in whole image, and each pixel in phase information and image is corresponded to;
Each section consistent with main body segment phase difference in whole image is extracted as by S2 respectively according to the phase information
Individual region segment realizes image separation;
The region segment is carried out virtualization processing by S3;
Each region segment is synthesized final background blurring photo by S4 with the main body segment.
Preferably, the segment of the object part of auto-focusing when the main body segment is image taking.
It is further preferred that each section consistent with main body segment phase difference in whole image is extracted as individually respectively
Region segment, specifically, the region consistent with main body segment phase difference and mutually adjacent of each section in whole image is made
Then it is several region segments according to phase difference in whole image for a region segment.
It is fallen into a certain range it is further preferred that the phase difference is unanimously phase difference.
It is further preferred that the region segment is subjected to virtualization processing, specifically,
According to the phase difference of each region segment of extraction, virtualization processing is carried out respectively, is connect with the main body segment phase
Close or identical region segment is stronger for the region segment virtualization effect bigger with main body segment phase difference without blurring,
It is weaker for the region segment virtualization effect smaller with main body phase difference.
The present invention one of at least has the advantages that:
1. using the included phase detection techniques of current mobile phone and digital camera, including separation camera lens and linear transducer etc.
Hardware and corresponding processing routine, in conjunction with system and method for the present invention, photo is background blurring, does not increase hardware additionally, and real
It is existing convenient and simple.
2. present invention is particularly suitable for the smart machine that mobile phone, tablet etc. carry shooting function, taken the photograph different from Professional Photography
As equipment, software and hardware expense of the present invention is small, hardly increases cost.
3. strengthening photo body matter, background is weakened, the power of virtualization is determined according to phase difference value, highlights master
The effect of body.
4. the present invention uses after tested, effect is ideal, function-stable.
Specific implementation mode
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technology description to be briefly described, it should be apparent that, following description and accompanying drawings are for the present invention
It is exemplary, and is understood not to the limitation present invention.Following description describe numerous details to facilitate to this hair
Sensible solution.However, in some instances, well known or conventional details does not specify simultaneously, to meet the succinct requirement of specification.
Processor is generally included using the equipment of the present invention, contains single core processor or multi-core processor.Processor can also claim
For one or more microprocessors, central processing unit (CPU) etc..More specifically, processor can be complicated instruction set meter
It calculates (CISC) microprocessor, reduced instruction set computing (RISC) microprocessor, very long instruction word (VLIW) microprocessor, realize it
The processor of his instruction set, or realize the processor of instruction set combination.Processor can also be one or more application specific processors, especially
It is graphics processor, or such as application-specific integrated circuit (ASIC), field programmable gate array (FPGA), Digital Signal Processing
Device (DSP), network processing unit, communication processor, cipher processor, coprocessor, embeded processor or being capable of process instruction
Any other type logical block.Processor is used to execute the instruction of operation and step that the present invention is discussed.
Such as Fig. 1, phase detection principle is as follows:Phase-detection hardware aspect includes one group of dialyte lens L and linear CCD
Image sensor array.Two images are isolated by dialyte lens L, are then examined by linear ccd image sensor array
Measure the distance between two images
Lens detach the use of phase-detection mode on the digital photographies picture pick-up device such as slr camera, mobile phone at present, and
A method of passing through phtographic lens.Lens detach phase detection device by one group of dialyte lens L and one or more groups of by photosensitive
The ranging component of element composition is constituted.Photosensitive element has three categories at present:The first kind is CCD photosensitive elements, and many producers all make
With this class component.CCD, full name in English:Charge-coupledDevice, Chinese name:Charge coupled cell.It is properly termed as
Ccd image sensor is also image controller.CCD is a kind of semiconductor devices, optical image can be converted into digital letter
Number.In addition the BASIS (BAse-Store Image Sensor, base store image sensor) and CMOS of Liang Leishi Canon companies
BASIS。
Photosensitive element on ranging component is to line up an array (being usually in line).The characteristics of above-mentioned photosensitive element
It is that will produce certain electric signal under light irradiation.The effect of dialyte lens L is will to be split by the light of phtographic lens
Two beams are simultaneously focused, and are projected on ranging component respectively.
Such as Fig. 1, below to be with the ranging component of ccd image sensor array (hereinafter referred to as ccd array) in the present invention
Example, to illustrate the operation principle of phase-detection.When focusing accurate, the two-beam line projection generated by dialyte lens L is in CCD
Distance on array is certain, to the position of that a pair of CCD element of charge caused by light beam irradiation on ccd array
It is also changeless.This has adjusted the distance between CCD elements when camera designs, as focus detection
Benchmark.
A in figure is seen when focusing accurate, the distance between a pair of of the CCD elements for being denoted as benchmark with XY.When focusing not
On time, there are two types of possibilities.One is camera lens focuses before subject, sees b in figure.At this time two CCD elements of light it
Between distance be shorter than XY;Another situation is camera lens focus after subject, sees c in figure, at this time the two of light CCD elements
The distance between be longer than XY, according to the distance between a pair of of CCD elements of light, it is whether accurate that focus can be identified.Two
Electric signal caused by CCD elements passes through conversion circuit and A/D conversion circuit, the CPU (processing being re-fed into camera
Device), CPU according to set by producer program and according to this to the distance of CCD elements and the difference of XY, defocus amount can be calculated
(i.e. the difference of actual focal spot and focus exact) and direction is defocused, that is, completes the required phase-detection of the present invention.
First embodiment
Such as a kind of embodiment schematic diagram that Fig. 2 is the background blurring system of photo.The background blurring system 100 of photo, including:
Image phase detection module 1 detects the phase information of each pixel in whole image, and phase information and image
In each pixel correspond to.The principle and particular content of phase-detection have been explained above, and details are not described herein again.
Image separation module 2, according to phase information, by each section consistent with main body segment phase difference in whole image point
It is indescribably taken as individual region segment, realizes image separation.The object part of auto-focusing when main body segment is image taking
Segment.When shooting, for main shooting portrait:The object of auto-focusing is people, then segment based on the segment of the portrait.Its
His neighboring buildings, trees, distant place the scenery such as mountain respectively according to and the phase difference of main body segment be extracted as individually
Region segment.The phase difference is practical reflect scenery relative to camera (or mobile phone etc., below by taking camera as an example) and people relative to
The range difference of camera.This example will be continued to use below.
Region segment is carried out virtualization processing by image blurring module 3.In addition to main body segment, that is, portrait, other administrative division maps
Block carries out virtualization processing.Virtualization processing is current existing image processing techniques.
And image synthesis unit 4, each region segment is synthesized to final background blurring photo with main body segment.
Wherein, using the phase information of main body segment as the benchmark compared, in whole image and main body segment phase difference
Consistent various pieces isolate several region segments.The phase information of actually region segment reflects the main body (example taken pictures
Such as people) distance relative to camera and other parts (such as scenery) relative to camera.According to general custom of taking pictures, as taking pictures
Main body, it is clear and prominent to need, background blurring to disclosure satisfy that this demand.
Above-described embodiment is optimized, preferred another embodiment is obtained, by whole image with main body segment phase
The consistent each section of difference is extracted as individual region segment respectively, specifically, by each section in whole image and main body segment
The consistent and mutually adjacent region of phase difference is then several regions according to phase difference in whole image as a region segment
Segment.If two pixels are consistent relative to the phase difference of main body segment, but their distances are very remote, and pixel is obviously discontinuous therebetween,
It can not then judge in the same segment.Illustrated with above-mentioned example, if be then people both sides respectively have respectively there are one trees and
One building, relative difference apart from camera and people apart from camera of trees and building, is nearly identical distance, then trees and builds
Although building consistent with the phase difference of people, there is no the consistent pixel of continuous phase difference in it from each other, will not be by
It is extracted as the same area segment, but becomes two individual region segments.
Phase difference is unanimously that phase difference is fallen into a certain range.Substantial phase difference is unanimously not offered as phase difference value must
Must be completely the same, but a range.Due to the specific same scenery or personage itself be unlikely to be one it is pure
Plane, phase necessarily a range rather than fixed value when imaging.As long as therefore system default is exactly one within the scope of this
A specific content constitutes a region segment.
Above-described embodiment is optimized, preferred another embodiment is obtained, region segment is subjected to virtualization processing, specifically
For, according to the phase difference of each region segment of extraction, virtualization processing is carried out respectively, it is close or identical with main body segment phase
Region segment is stronger for the region segment virtualization effect bigger with main body segment phase difference without virtualization, for and main body
The smaller region segment virtualization effect of phase difference is weaker.The power that virtualization is determined according to phase difference value, highlights main body
Effect.
In the following, the preferred embodiment of photo background-blurring method of the present invention is illustrated with Fig. 4 according to fig. 3.If Fig. 3 is this
Invention photo background-blurring method flow diagram, the specific steps are:
S1 detects the phase information of each pixel in whole image, and each pixel in phase information and image is corresponded to;
Each section consistent with main body segment phase difference in whole image is extracted as individually by S2 respectively according to phase information
Region segment, realize image separation.
Region segment is carried out virtualization processing by S3.
Each region segment is synthesized final background blurring photo by S4 with main body segment.
Fig. 4 is that main body segment of the present invention and administrative division map block diagram picture detach schematic diagram.Such as Fig. 4, believed by obtained phase difference
Breath, separates image consistent with main body phase difference in image, if Fig. 4 isolates A, B, C, D4 segments, wherein A is
Picture center i.e. main body segment, it is assumed that main body segment A is that the object of auto-focusing is taken the image of people;Region segment
B is the image on a farthest mountain;Region segment C is the image of one tree;Region segment D is the image of a building.One
Mountain is remote relative to the vertical range ratio of the camera people that is taken;One tree is close relative to the vertical range ratio of the camera people that is taken;One
A building and the people that is taken relative to the vertical range of camera are in same plane.We do auto-focusing to the people that is taken, right
After the completion of coke, in the image formed in camera image preview, phase information is one to main body segment A in the image sensor
Fixed value 0.Since the object of region segment B shootings is remoter than the object distance that main body segment A is shot, so region segment B is schemed
As the phase information that sensor detects is a number less than 0.The object of region segment C shootings is clapped than main body segment A
The distance for the object taken the photograph is close, so region segment C detects that phase information is a number more than 0 by imaging sensor.
The object of region segment D shootings and the object A of main body segment shooting are in same plane, so what it was detected by imaging sensor
Phase information is also 0 as main body segment A.Since the phase difference of each region is different, can be gone out with delamination each
Segment.
Later, according to the phase difference of each region segment of extraction, virtualization processing is carried out respectively, with main body segment A phases
Close or identical region segment D is without virtualization.More for the region segment virtualization effect bigger with main body segment A phase differences
By force, then region segment B virtualizations effect is stronger;It is weaker for the region segment virtualization effect smaller with main body phase difference, then region
Segment C virtualizations effect is weaker.In the photo finally obtained, the image of portrait and building is without virtualization, a mountain void of distant place
Change effect is most strong, and closer one tree virtualization effect is weaker.The main contents for needing to shoot are highlighted in this way.
In order to protrude the innovative part of the present invention, the above-mentioned each apparatus embodiments of the present invention will not be with solution institute of the present invention
The technical issues of proposition, the less close module of relationship introduced, this does not indicate above equipment embodiment and there is no other moulds
Block.
It should be noted that in the claim and specification of this patent, such as first and second or the like relationship
Term is only used to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying
There are any actual relationship or orders between these entities or operation.Moreover, the terms "include", "comprise" or its
Any other variant is intended to non-exclusive inclusion so that including the processes of a series of elements, method, article or
Equipment includes not only those elements, but also includes other elements that are not explicitly listed, or further include for this process,
Method, article or the intrinsic element of equipment.In the absence of more restrictions, being wanted by what sentence " including one " limited
Element, it is not excluded that there is also other identical elements in the process, method, article or apparatus that includes the element.
Above-described embodiment can be freely combined as needed.The above is only a preferred embodiment of the present invention, should
It points out, for those skilled in the art, without departing from the principle of the present invention, if can also make
Dry omission, improvements and modifications, these improvements and modifications also should be regarded as protection scope of the present invention.