Image blurring processing method and processing device
Technical field
The present invention relates to digital image processing techniques field, more particularly to a kind of image blurring processing method and processing device.
Background technology
Micro-landscape specially good effect is primarily used to simulate moves the effect that lens shaft shoots the shallow depth of field produced during real scene.This
Planting the design sketch of the shallow depth of field can give people a kind of sensation of shooting manikin.Under normal circumstances, camera focal plane and film plane
Parallel, when being shot with large aperture, scenery on focal plane is clear and afocal is fuzzy.But during with moving lens shaft shooting, due to mirror
Head can be moved and waved, and change the angle that light projects photo-sensitive cell, so as to change articulation point so that even if same burnt flat
The scenery in face can also easily produce the effect of the shallow depth of field.
Generally there is a circle of good definition and dividing by the circle of good definition using the micro-landscape picture moved captured by lens shaft
The confusion region that boundary line outwards gradually fogs, existing micro-landscape image generally by a middle circle of good definition and it is upper and lower two gradually
The confusion region composition of change.In order that general camera or photographic head shoot the image for coming and also have above-mentioned micro-landscape specially good effect, it is existing
Have in technology commonly use method be first calculate confusion region in need fuzzy pixel to middle circle of good definition it is marginal away from
From the ratio value with confusion region vertical width, then calculate or select the template of correspondence fog-level to carry out mould to the pixel
Paste process.The Chinese patent application of such as Publication No. CN102509294A is disclosed to be carried out at Gaussian Blur to single image
Reason, can obtain broad image.
Inventor has found in research process is carried out to prior art, due to the receptible meter of single pixel point institute
Calculate complexity or hardware implementation cost is limited, it is also limited for carrying out the size of maximum template of Fuzzy Processing, particularly work as
When image resolution ratio to be dealt with is very high, the little template maximum fog-level to be reached is it is difficult to satisfactory.With Gaussian mode
As a example by paste, visually for, for the image of 8,000,000 resolution, to more satisfied fog-level can be reached, generally
The template size for using should be more than 31 × 31, and the template size recommended should be 61 × 61~81 × 81.Assume using 31 ×
The template of 31 fixed size is obscured, and needs to carry out fuzzy pixel accounts for image size 50%, then calculate total
The multiply-add operation of 4,000,000,000 times is needed access to altogether, i.e.,:31 × 31 × 8 × 106 × 50% ≈ 3,800,000,000 times.
Inventor has found, for the above-mentioned existing method for realizing image micro-landscape specially good effect Fuzzy Processing, deposits
In following problem:
First, in order to reach relatively satisfactory fog-level, the Fuzzy Template of required selection is very big.It is required and template is bigger
The calculation times for carrying out are more.For the image of a width high-resolution, the multiply-add operation of tens times is generally required, calculated
Speed is slower, consumes very much resource.
Secondly, for different size of image, in order to reach more consistent fog-level, the size of required template also can phase
Should difference.If using the template of fixed size, using when processing low-resolution image compared with large form, to obtain and high-resolution
The same fog-level of rate image, only template middle part element non-zero, and element is mostly zero around template, therefore can introduce very
More unnecessary computing, adaptivity is poor.
In summary, the existing image blurring processing method for realizing micro-landscape specially good effect, its Fuzzy Processing arithmetic speed
Slowly, adaptivity is poor.
The content of the invention
To solve above-mentioned at least one problem of the prior art, the embodiment of the present invention provides a kind of image blurring process side
Method and device, it is possible to increase Fuzzy Processing speed, with preferable adaptivity.
A kind of image blurring processing method is embodiments provided, including:Circle of good definition and confusion region in image is set
Demarcation line;The sampling fuzzy parameter of confusion region is arranged according to image size to be dealt with;Using set confusion region
Sampling fuzzy parameter is sampled Fuzzy Processing to confusion region;Calculate the corresponding Fuzzy Template of pixel in confusion region;Using
To Fuzzy Template to sample Fuzzy Processing after confusion region in the pixel carry out fuzzy filter.Optionally, described
According to image size to be dealt with, the sampling fuzzy parameter of confusion region is set, including:Arranged according to image size to be dealt with
The image drop sampling ratio value of confusion region and/or pixel sampling interval are worth.
Optionally, when the sampling fuzzy parameter that confusion region is arranged according to image size to be dealt with is included according to being located
When the image size of reason arranges the image drop sampling ratio value of confusion region, the fuzzy ginseng of the sampling using set confusion region
It is several Fuzzy Processing is sampled to confusion region to include:Confusion region is carried out using set image drop sampling ratio value down-sampled
Process;The corresponding Fuzzy Template of pixel in the calculating confusion region, including:Calculate and determine in the confusion region after down-sampled process
Pixel needs the degree being blurred;The degree being blurred is needed to calculate pixel described in the confusion region according to the pixel
The corresponding Fuzzy Template of point.
Optionally, when the sampling fuzzy parameter that confusion region is arranged according to image size to be dealt with is included according to being located
It is described using set when the image size of reason arranges the image drop sampling ratio value of confusion region and pixel sampling interval value
The sampling fuzzy parameter of confusion region is sampled Fuzzy Processing to confusion region also to be included:Using the set pixel sampling interval
Value, the pixel region to being currently needed for Fuzzy Processing in confusion region after down-sampled process is sampled process.
Optionally, described image fuzzy processing method also includes:A liter sampling processing is carried out to the confusion region after fuzzy filter.
Optionally, the confusion region by after Fuzzy Processing carries out a liter sampling processing and is specially:Using arest neighbors interpolation, double
Line style interpolation or bicubic interpolation method carry out interpolation processing.
Optionally, pixel needs the degree being blurred in the confusion region calculated after down-sampled process, specially:Root
It is vertical wide with the image after down-sampled process according to current pixel point in the image after down-sampled process to marginal beeline
The ratio of degree determines that pixel needs the degree being blurred.
Optionally, according to current pixel point in the image after down-sampled process to marginal beeline and down-sampled place
The ratio of the image vertical width after reason determines that pixel needs the degree being blurred, specially:By the image after down-sampled process
The ratio or ratio mapping of the image vertical width after middle current pixel point to marginal beeline and down-sampled process is right
The fuzzy series answered are used as fuzzy coefficient.
Optionally, it is described to need the degree being blurred to calculate Fuzzy Template according to pixel, specially:Determine Fuzzy Template
Type and size;According to calculated fuzzy coefficient and the type and size of the Fuzzy Template for determining, it is calculated current
Pixel is used for fuzzy Fuzzy Template.
Optionally, when the sampling fuzzy parameter that confusion region is arranged according to image size to be dealt with is included according to being located
When the image size of reason arranges pixel sampling interval value, the sampling fuzzy parameter using set confusion region is to fuzzy
Area is sampled Fuzzy Processing, including:Using set pixel sampling interval value to being currently needed for fuzzy pixel institute
Process is sampled in region.
Optionally, described image fuzzy processing method also includes:Image is processed to strengthen the model of described image
Sense.
Optionally, it is described that the process that image is carried out is included to carry out entire image brightness adjustment, saturation adjustment, contrast
Image border enhancement process wherein at least one in degree adjustment and circle of good definition.
The embodiment of the present invention additionally provides a kind of image blurring processing meanss, including:Demarcation line setting unit, for arranging
The demarcation line of circle of good definition and confusion region in image;Sampling fuzzy parameter setting unit, for according to image size to be dealt with
The sampling fuzzy parameter of confusion region is set;Sampling Fuzzy Processing unit, for using the fuzzy ginseng of the sampling of set confusion region
It is several that Fuzzy Processing is sampled to confusion region;Fuzzy Template computing unit, determines that pixel is corresponding in confusion region for calculating
Fuzzy Template;Fuzzy filter unit, for the Fuzzy Template that obtained using Fuzzy Template computing unit to Fuzzy Processing list of sampling
Confusion region after unit is processed carries out fuzzy filter.
Optionally, the sampling fuzzy parameter setting unit includes:First parameter setting subelement, for according to being located
The image size of reason arranges the image drop sampling ratio value of confusion region;The sampling Fuzzy Processing unit includes that down-sampled son is single
Unit, the image drop sampling ratio value for being arranged using the first parameter setting subelement carries out down-sampled process to confusion region.
Optionally, the sampling fuzzy parameter setting unit also includes the second parameter setting subelement, for according to wanting
The image size of process arranges pixel sampling interval value;The sampling Fuzzy Processing unit also includes interval sampling subelement,
For being sampled process to the fuzzy pixel region that is currently needed in the confusion region after the process of down-sampled subelement.
Optionally, described image Fuzzy Processing device also includes:Sampling unit is risen, for fuzzy filter unit to be obscured into place
Confusion region after reason carries out a liter sampling processing.
Optionally, the sampling fuzzy parameter setting unit includes:Second parameter setting subelement, for according to being located
The image size of reason arranges pixel sampling interval value;The sampling Fuzzy Processing unit includes interval sampling subelement, is used for
Process is sampled to the fuzzy pixel region that is currently needed in the confusion region after the process of down-sampled subelement.
Optionally, described image Fuzzy Processing device also include model sense enhancement unit, for image is processed with
Strengthen the model sense of described image.
As can be seen from the above technical solutions, by before fuzzy filter is carried out to image, according to image to be dealt with
Size is sampled Fuzzy Processing to confusion region, and the fixed form such that it is able to selection of small carries out Fuzzy Processing, therefore can be with
Arithmetic speed is improved, the level of resources utilization is improved.And for different size of image, by arranging the fuzzy ginseng of different sampling
Number, you can more consistent fuzzy fade effect is obtained, with good adaptivity.
In addition, the fuzzy meter of participation can be reduced by carrying out down-sampled process to the confusion region in image before fuzzy filter
The pixel number of calculation, therefore calculating speed can be improved, economize on resources.Also, for different image sizes can be arranged not
Same image drop sampling ratio value, therefore different size of image blurring area can be obscured using less fixed form
Filtering, obtains more consistent fuzzy fade effect, with good adaptivity.
By arranging different pixel sampling interval values, process is sampled to confusion region pixel, such that it is able to obtain
Bigger fog-level is obtained, therefore less fixed form can be adopted, Fuzzy Processing is carried out to different size of image.Due to
Different size of image is adapted to, thus with preferable adaptivity, and less fixed form is adopted, relative to employing
Larger template or different templates, it is also possible to improve calculating speed.
Description of the drawings
Fig. 1 is image blurring process flow figure in the embodiment of the present invention one;
Fig. 2 is a kind of schematic layout pattern of the fuzzy special effect graph picture of micro-landscape in the embodiment of the present invention one;
Fig. 3 is the schematic layout pattern that another kind of micro-landscape obscures special effect graph picture in the embodiment of the present invention one;
Fig. 4 is that pixel fuzzy coefficient in confusion region calculates schematic diagram in the embodiment of the present invention one;
Fig. 5 is image blurring process flow figure in the embodiment of the present invention two;
Fig. 6 is down-sampled Method And Principle schematic diagram in the embodiment of the present invention;
Fig. 7 is pixel sampling approach principle schematic in the embodiment of the present invention;
Fig. 8 is image blurring processing device structure diagram in the embodiment of the present invention three.
Specific embodiment
In the embodiment of the present invention, the sampling fuzzy parameter of confusion region is arranged according to image size to be dealt with, adopted afterwards
Fuzzy Processing is sampled to confusion region with the sampling fuzzy parameter of set confusion region, and is calculated confusion region pixel
After corresponding Fuzzy Template, fuzzy filter is carried out using pixel in confusion region of the Fuzzy Template for obtaining to sampling after fuzzy,
Broad image can be obtained, camera micro-landscape specially good effect is realized.
Such scheme can adopt less fixed form, and by being sampled to confusion region after Fuzzy Processing mould is carried out again
Paste filtering, on the premise of preferable visual effect is ensured, it is possible to increase arithmetic speed.Also, for the image of different resolution,
The little template of fixed size can be adopted, by arranging different sampling fuzzy parameters, you can obtain more consistent fuzzy gradual change
Effect, therefore with preferable adaptivity.
To more fully understand those skilled in the art and realizing the present invention, referring to the drawings, by specific embodiment
It is described in detail.
Embodiment one
Image blurring process flow figure with reference to shown in Fig. 1, is described in detail below by way of concrete steps.
S101, arranges the demarcation line of circle of good definition and confusion region in image.
The fuzzy special effect graph picture of the present embodiment micro-landscape to be dealt with is by a middle circle of good definition and surrounding one or many
Individual confusion region composition, set demarcation line can be closed curve.Micro-landscape special effect graph picture with reference to shown in Fig. 2 and Fig. 3
Schematic layout pattern, wherein, in Fig. 2, mid portion be circle of good definition 201, upper and lower two parts be need from the boundary with circle of good definition
Line outwards carries out the confusion region 202 and confusion region 203 of gradual change Fuzzy Processing, and in Fig. 3, centre is circle of good definition 301, and demarcation line is
Curve, surrounding is from the confusion region 302 obscured with the outside gradual change in the demarcation line of circle of good definition.
It is understood that arranging the marginal position that demarcation line arranges middle circle of good definition and surrounding confusion region.It is logical
Cross and marginal position is set can change the location and shape of circle of good definition, in being embodied as, can manually arrange, it is also possible to
Arranged automatically according to feature of image by equipment itself, or some default shapes are set and selected for user with position, for example clearly
Area's acquiescence in the picture between region, default shape can be rectangle, circular, ellipse etc., and user can select default setting, also may be used
To be adjusted again on the basis of default setting.
S102, according to image size to be dealt with the image drop sampling ratio value of confusion region is arranged.
For different size of image, the maximum fog-level that can be reached using the template of fixed size is different,
For especially for big image, the fog-level of little template is very weak, and the final visual effect for producing is poor.In order to improve little mould
Fuzzy progressive formation is not produced while plate fog-level and significantly affected, by passing through drop to image blurring area in the present embodiment
Sampling is processed.
In being embodied as, the comparatively ideal image drop sampling of final blur effect can be provided according to the size of common image
Ratio value.By taking template size 15 × 15 as an example, for resolution is 1,000,000 and following image, image drop sampling can not be used,
Down-sampled ratio value is set for 1;For image of the resolution 2 million to 5 million, down-sampled ratio value can be set for 2;For
Image of the resolution 6,000,000 to 8,000,000, can arrange down-sampled ratio value for 4;For the image that size is more than 8,000,000, Ke Yijin
One step improves the down-sampled ratio value of image.It is understood that different ratio values is not constituted to the scope of the present invention
Limit, those skilled in the art can be arranged as required to.
In being embodied as, the common corresponding image drop sampling ratio value of image size can be preserved and be arranged, also may be used
Selected for user with providing self-defined setting.
S103, down-sampled process is carried out using set image drop sampling ratio value to confusion region.
In being embodied as, various down-sampled methods can be adopted.For example, directly confusion region can be dropped at equal intervals
Sampling, it is also possible to confusion region is carried out through the disposal of gentle filter down-sampled.The former is relative, and the latter is realized with computational methods more
Simply.
If image drop sampling ratio value is k, at equal intervals down-sampled method is i.e. every to confusion region in the vertical and horizontal directions
Retain a sampled point every k pixel, the new confusion region size for finally producing is the 1/k2 of former confusion region size.And pass through flat
The down-sampled method of sliding Filtering Processing is on the basis of equal interval sampling method, to both horizontally and vertically going up neighbouring sample point
The region of the k2 sizes of composition is weighted averagely, the retention of resulting result as current sampling point.
It is understood that different down-sampled methods itself does not constitute limiting the scope of the invention.
S104, calculates the degree that the pixel of confusion region after down-sampled process needs to be blurred.
The purpose for calculating fog-level is to calculate or choose the template for each pixel of Fuzzy Processing.Can adopt many
The method of kind is calculated.In the present embodiment, according to current pixel point to marginal beeline and 1/k image vertical widths
Ratio is used as the fuzzy coefficient for calculating or choosing template.As shown in figure 4, dotted line frame 400 is original image boundary line, dotted line 401
For the circle of good definition and confusion region demarcation line of original image, solid box 402 is by the image side after the down-sampled process of original image 400
Frame, solid line 403 is the demarcation line of new circle of good definition and confusion region after down-sampled process, and Pi is to treat in new confusion region after down-sampled process
The pixel of process.In the present embodiment, fuzzy coefficient computing formula can be expressed as follows:
Wherein, parameter alpha i is the ratio of ith pixel point in new confusion region after down-sampled process, reflects the pixel needs
The degree being blurred, D is the vertical width of original image, and di is ith pixel point in new confusion region to marginal most short distance
From.
In being embodied as, fuzzy coefficient α i can also be obtained according to method that is similar or simplifying.For example, D/k can be pressed
It is divided into LevelMax sections according to the maximum fuzzy series LevelMax being previously set, residing according to the α i values of current pixel point afterwards
Fuzzy series calculate or select corresponding Fuzzy Template.It is understood that the different implementation of parameter alpha i do not constitute it is right
The restriction of the scope of the present invention.
S105, needs the degree being blurred to calculate the corresponding fuzzy mould of the pixel according to pixel in step S104
Plate.
In being embodied as, the type and size of Fuzzy Template, and the Fuzzy Template according to determined by are can determine first
Type and size, and the calculated fuzzy coefficient of step S104, it is fuzzy for what is obscured to be calculated current pixel point
Template.In the present embodiment, the Gaussian template of 15 × 15 sizes is selected.Due to template size it is limited, when Gaussian function standard deviation sigma increase
When greatly to certain value, the weighted value of each element is varied less in Gaussian template, thus can arrange the excursion of σ 0~
SigmaMax, SigmaMax takes 15 in the present embodiment.
Then current pixel point is produced as the value of σ using the result of α i × SigmaMax and is used for fuzzy Gaussian template.It is false
If the coordinate of template center's element is for (0,0), i.e., template center's element is arranged in the 0th row the 0th, the power of each element in specific template
Weight values can be calculated using equation below:
Wherein, h (n1,n2) represent the element value of the row of the n-th 1 rows in template the n-th 2, n1, n2=-7 ..., 7,For h
(n1,n2) normalization result.In final template the weighted value of each element i.e. byRepresent.
S106, fuzzy filter is carried out using calculated template in step S105 to the confusion region after down-sampled process.
After fuzzy filter is carried out to a pixel, judge it is down-sampled after confusion region in all pixels point whether all locate
Manage, if it is, execution step S107;If it is not, then to next pixel execution step S104~S106 in confusion region,
Until all of pixel has all been processed in the confusion region after down-sampled process.
S107, by the confusion region after fuzzy filter a liter sampling processing is carried out.
After all having processed the pixel in the confusion region after down-sampled, the result liter after Fuzzy Processing is sampled fuzzy
Size before area is down-sampled.A liter sampling processing is carried out to confusion region, can be able to be using interpolation method, specific interpolation method
Arest neighbors interpolation, two-wire type interpolation or bicubic interpolation.It is understood that specifically rise sampling processing method do not constitute it is right
The restriction of the scope of the present invention.
From the present embodiment as can be seen that before Fuzzy Processing is carried out to image, being dropped using the image for pre-setting confusion region
Oversampling ratio value carries out down-sampled process, and the degree that should be blurred according to the confusion region after down-sampled process to confusion region,
The corresponding Fuzzy Template of each pixel in the confusion region after down-sampled process is calculated, and using calculated Fuzzy Template to drop
Confusion region after sampling processing carries out fuzzy filter, realizes the Fuzzy Processing of camera micro-landscape special effect graph picture.Therebetween, fuzzy
Carrying out down-sampled process before filtering to the confusion region in image can reduce the pixel number of participation Fuzzy Calculation, therefore can carry
High calculating speed, economizes on resources.Also, for different image sizes can arrange different image drop sampling ratio values, because
This can carry out fuzzy filter to different size of image blurring area using less fixed form, obtain it is more consistent it is fuzzy gradually
Become effect, with good adaptivity.
In being embodied as, above-mentioned image blurring processing method can be extended, to obtain better image process
Effect.For example, in order that the image of the fuzzy specially good effect of the micro-landscape for ultimately generating has more model sense, can be right before Fuzzy Processing
Image carries out some pretreatment.
Image semantic classification includes carrying out entire image on image side in brightness, saturation, setting contrast and circle of good definition
Edge enhancement process, in being embodied as, can as needed, using one or more of which mode.Related brightness, saturation
Degree, setting contrast and edge enhancement process technology are quite ripe, and here is omitted for relevant implementation method.
It is understood that the process of above-mentioned enhancing iconic model sense can also be after the completion of Fuzzy Processing or fuzzy place
During reason, here is omitted.
For different size of image, the maximum fog-level that can be reached using the template of fixed size is different,
For especially for big image, the fog-level of little template is very weak, and the final visual effect for producing is poor.In order to improve little mould
Fuzzy progressive formation is not produced while plate fog-level and significantly affected, above-described embodiment can also be made further excellent
Change, two be described in detail by the following examples.
Embodiment two
It is that the present embodiment is also using the pixel sampling interval for arranging to confusion region pixel with the difference of embodiment one
The method that point is sampled process, i.e., with reference to image blurring area is down-sampled and confusion region pixel two kinds of processing methods of point sampling, ginseng
According to the image blurring process flow figure shown in Fig. 5, following steps are specifically included:
S501, pretreatment is carried out to image to strengthen iconic model sense.
As it was previously stated, to strengthen iconic model sense, various process can be carried out to image, for example, image can be carried out bright
Degree, saturation, setting contrast, it is also possible to while or only enhancement process is carried out to image border in circle of good definition, repeat no more.On
Stating the process of enhancing iconic model sense can also be carried out after Fuzzy Processing is carried out to image.
S502, arranges the demarcation line of circle of good definition and confusion region in image.
The marginal position that demarcation line arranges middle circle of good definition and surrounding confusion region is set, thus it is possible to vary circle of good definition
Location and shape, preferably meet user's request.
S503, according to image size to be dealt with image drop sampling ratio value and pixel sampling interval value are arranged.
In the present embodiment, the comparatively ideal down-sampled ratio value of final blur effect and picture are provided according to common image size
The vegetarian refreshments sampling interval is worth.By taking template size 15 × 15 as an example, for resolution is 1,000,000 and following image, figure can not be used
Directly Fuzzy Processing is carried out to image blurring area as down-sampled and pixel sampling approach, that is, down-sampled ratio value and picture are set
Vegetarian refreshments sampling interval value is 1;For respectively rate is 2,000,000 to 3,000,000 image, it is 1 that can arrange down-sampled ratio value, and pixel is taken out
Sample spacing value is 2;For image of the resolution 4,000,000 to 5,000,000, it is 2 that can arrange down-sampled ratio value, pixel sampling interval value
For 1;For image of the resolution 6,000,000 to 8,000,000, down-sampled ratio value can be set for 4, pixel sampling interval value for 1 or
2, the image for more than 8,000,000 can further improve ratio value and spacing value.It is understood that different ratio values and
Spacing value is not construed as limiting the invention.
Inventor has found that the down-sampled ratio value or pixel sampling interval that two methods are arranged is worth and above-mentioned preferable setting
When value difference is too big, has respective side effect and produce, affect fuzzy visual effect, such as, if image drop sampling ratio value
Arrange it is excessive when, it is possible that the obvious situation in demarcation line of confusion region and circle of good definition, and if the pixel sampling interval
Value arrange it is excessive when, low confusion region may substantially observe latticed phenomenon after amplifying.And down-sampled ratio value and pixel
Sampling interval value is combined and selected, and can avoid the generation of above two phenomenon, obtains the fuzzy specially good effect of preferably micro-landscape
Effect.In being embodied as, recommended parameter can be used as user's selection by some preferably parameter values by experimental selection.
S504, the down-sampled ratio value arranged using step S503 carries out down-sampled process to confusion region.
In being embodied as, various down-sampled methods can be adopted.For example, directly confusion region can be dropped at equal intervals
Sampling, it is also possible to carry out through the disposal of gentle filter and to confusion region down-sampled.I will not elaborate.
S505, the fuzzy coefficient of each pixel in the confusion region after the down-sampled process of calculation procedure S504.
The degree that each pixel needs to be blurred can be redefined according to the down-sampled ratio in image blurring area, be calculated
Fuzzy coefficient.Concrete methods of realizing can refer to embodiment one, and I will not elaborate.
S506, according to calculated fuzzy coefficient in step S505 Fuzzy Template is calculated.
In the present embodiment, using the Gaussian template of 15 × 15 sizes.Due to template size it is limited, when Gaussian function standard deviation
When σ increases to certain value, the weighted value of each element is varied less in Gaussian template, thus can arrange the excursion of σ 0~
SigmaMax, SigmaMax takes 15 in the present embodiment.
It is understood that in being embodied as, it is also possible to select other kinds of Fuzzy Template, such as mean filter mould
Plate.Also, according to image size to be dealt with, the different size of Fuzzy Template of variety classes can be selected.
S507, enters according to the pixel sampling interval that step S503 is arranged to being currently needed for fuzzy pixel region
Line sampling process.
In order to obtain bigger fog-level, before fuzzy filter is carried out to confusion region, according to the picture of step S503 setting
The vegetarian refreshments sampling interval is sampled process to being currently needed for fuzzy pixel region.For example, when the sampling interval is 2, choosing
30 × 30 size areas centered on current pixel point in confusion region are taken, the square that decimation obtains 15 × 15 is carried out
Battle array.
S508, using calculated Fuzzy Template in step S506 to sample process in the confusion region after down-sampled process
Pixel afterwards carries out fuzzy filter.
Matrix resulting after the current pixel point sample process of confusion region will be calculated with step S506 in step S507
To template carry out process of convolution, the convolution results of central pixel point are the pixel value after the pixel fuzzy filter.
To the pixel of confusion region after down-sampled process successively execution step S505~S508, until down-sampled process rear mold
Paste area's all pixels point has all been processed.Wherein, step S507 does not have obvious time sequencing with step S505 and S506.
S509, by the confusion region after fuzzy filter a liter sampling processing is carried out.
After the completion of to all of pixel all Fuzzy Processings in the confusion region after down-sampled process, by the knot after Fuzzy Processing
Fruit rise sample confusion region it is down-sampled before size.Carrying out liter sampling processing can be inserted using interpolation method, such as arest neighbors
Value, two-wire type interpolation, bicubic interpolation etc., concrete grammar is no longer described in detail.It is understood that specifically rising the method for sampling not
It is construed as limiting the invention.
To make those skilled in the art more fully understand the present invention, below by way of specific embodiment image is dropped respectively
The method that sampling processing and pixel sampling interval are processed is illustrated.
First, the method for carrying out down-sampled process to image is as follows:As shown in fig. 6, to one piece of image-region 601(Size
For M × N)It is the down-sampled of k to carry out ratio value, and after sampling, image size is changed into M × N/ (k2), that is, the rear mold of participation
The pixel number that plate is calculated is kept to original 1/k2.
Fuzzy coefficient α i, wherein D=Mk are calculated according to the image 602 after down-sampled2, unit in Gaussian template is calculated according to α i
Element value, wherein, the size of template is set, such as 15 × 15, compare 61 × 61 size it is much smaller.Participated in by reducing
The number of the pixel that fuzzy filter is calculated, can improve calculating speed.
Using the set pixel sampling interval, the method that pixel interval sampling process is carried out to pixel is as follows:
With reference to Fig. 7, it is assumed that the size of template 704 is 5 × 5, and in image 701 and 702, each square lattice represents a picture
Element.
Referring first to image 701, when sample value is 1, centered on current pixel point, it is continuous choose in image 701 with
The equirotal region of template 704, for Fuzzy Calculation;Image 702 illustrate sample value be 2 when, dot interlace choose image 702 in 10
× 10 size areas are obtained and the equirotal region 703 of template 704, for Fuzzy Calculation.
Knowable to illustrating more than, the method for down-sampled process, it is possible to reduce participate in the pixel total number of formwork calculation, be
M × N/k2, and process in region of the pixel sampling approach after down-sampled, will not reduce in the region after down-sampled process
The pixel number for calculating is participated in, that is, the pixel for participating in the process of pixel sampling approach is still M × N/k2, but can be increased
Participate in the size in the region of formwork calculation.As being sampled process to image 702 in Fig. 7, although participate in fuzzy filter calculating and take out
The number of the point for taking remains as 5 × 5, but is believed that the area size image 702 for participating in fuzzy filter calculating is the 4 of image 701
Times, so that the fog-level that image 702 is obtained is 4 times of image 701(Assume fog-level and participate in what fuzzy filter was calculated
The area in region is directly proportional), it may thus be appreciated that, although pixel sampling approach does not reduce the pixel total number for participating in calculating, but
In the situation that template size is fixed, bigger fog-level can be obtained.
It can be seen that, by carrying out image drop sampling process to confusion region, and to the pixel in confusion region after down-sampled process
It is sampled process, it is possible to reduce participate in the pixel number of Fuzzy Processing, therefore calculating speed can be improved, and mould can be improved
The fog-level in paste area, therefore smaller template can be adopted, and it is possible to using the template of fixed dimension, arrange not
Same sampling fuzzy parameter, including image drop sampling ratio value and pixel sampling interval value, are carried out to different size of image
Fuzzy Processing, and preferable concordance can be obtained, therefore with good adaptivity.
In being embodied as, it will be appreciated by persons skilled in the art that realizing micro-landscape specially good effect in Fuzzy Processing
During, it is also possible to only with value of default pixel sampling interval, pixel sample process is carried out to the pixel of confusion region
Carry out fuzzy filter again afterwards.Now, then the liter sampling processing after down-sampled and fuzzy filter need not be carried out to image blurring area,
Also without recalculating the degree that confusion region current pixel point needs to be blurred, but directly select confusion region current pixel point
Suitable template type and size as Fuzzy Template, and by the template for selecting with to pixel described in confusion region using default
Resulting matrix carries out process of convolution after the process of pixel sampling interval value, you can obtain the picture after the pixel fuzzy filter
Element value.
By arranging different pixel sampling interval values, process is sampled to confusion region pixel, such that it is able to obtain
Bigger fog-level is obtained, therefore less fixed form can be adopted, Fuzzy Processing is carried out to different size of image, due to
Different size of image is adapted to, thus with preferable adaptivity, and less fixed form is adopted, relative to employing
Larger template or different templates, it is also possible to improve calculating speed.
To more fully understand those skilled in the art and realizing the present invention, below by way of specific embodiment to said method
Corresponding device describes in detail.
Embodiment three
Image blurring processing meanss with reference to shown in Fig. 8, including:Demarcation line setting unit 801, sampling fuzzy parameter are arranged
Unit 802, sampling Fuzzy Processing unit 803, Fuzzy Template computing unit 804 and fuzzy filter unit 805, wherein:
Demarcation line setting unit 801, for arranging image in circle of good definition and confusion region demarcation line;
Sampling fuzzy parameter setting unit 802, for arranging the sampling mould of confusion region according to image size to be dealt with
Paste parameter;
Sampling Fuzzy Processing unit 803, is carried out for the sampling fuzzy parameter using set confusion region to confusion region
Sampling Fuzzy Processing;
Fuzzy Template computing unit 804, for calculating the corresponding Fuzzy Template of pixel in confusion region is determined;
Fuzzy filter unit 805, the Fuzzy Template for being obtained using Fuzzy Template computing unit 804 is fuzzy to sampling to be located
Confusion region after reason unit 803 is processed carries out fuzzy filter.
In the present embodiment, by the demarcation line of circle of good definition and confusion region in the setting image of demarcation line setting unit 801, and by
Sampling fuzzy parameter setting unit 802 arranges the sampling fuzzy parameter of confusion region according to image size to be dealt with, by sampling
Fuzzy Processing unit 803 is sampled process to confusion region using the sampling fuzzy parameter of set confusion region, then using meter
The template for obtaining carries out fuzzy filter to the confusion region after sample process, realizes the Fuzzy Processing of micro-landscape specially good effect, due to
Different sampling fuzzy parameters can be arranged according to image size in advance, to be sampled processs to confusion region, therefore can using compared with
Little fixed form, therefore the speed of Fuzzy Processing can be improved, and with preferable adaptivity.
In being embodied as, with reference to Fig. 8, sampling fuzzy parameter setting unit 802 can include:First parameter setting is single
Unit 8021, for arranging the image drop sampling ratio value of confusion region according to image size to be dealt with;Correspondingly, sample fuzzy
Processing unit includes down-sampled subelement 8031, for the image drop sampling ratio arranged using the first parameter setting subelement 8021
Example value carries out down-sampled process to confusion region.
By being carried out to image blurring area using the image drop sampling ratio value for pre-setting to down-sampled subelement 8031
Down-sampled process, it is possible to reduce participate in the pixel of blurring filter operations, such that it is able to improve calculating speed, and can be according to difference
Image size different down-sampled ratio values are set, therefore the less fixed form of size can be adopted, obtain more consistent
Fuzzy fade effect, with preferable adaptivity.
In being embodied as, sampling fuzzy parameter setting unit 802 may also include the second parameter setting subelement 8022, use
According to image size to be dealt with setting pixel sampling interval value;Correspondingly, Fuzzy Processing unit 803 of sampling can also be wrapped
Include interval sampling subelement 8032, for down-sampled subelement 8031 process after confusion region in be currently needed for fuzzy picture
Vegetarian refreshments region is sampled process.
By the pixel sampling interval according to set by image size, current pixel point region in confusion region is carried out
Sample process, can increase the size in the region for participating in formwork calculation, obtain bigger fog-level, less due to adopting
Fixed form, therefore the efficiency of Fuzzy Processing can be improved, and to different size of image, with preferable adaptivity.
In the embodiment above, if carrying out down-sampled process to image blurring area using down-sampled subelement 8031,
Described device may also include liter sampling unit 806, adopt for carrying out rising the confusion region after the Fuzzy Processing of fuzzy filter unit 805
Sample process.
In being embodied as, sampling fuzzy parameter setting unit 802 can only include the second parameter setting subelement 8022,
For arranging pixel sampling interval value according to image size to be dealt with.Correspondingly, sampling Fuzzy Processing unit 803 can be with
Only include interval sampling subelement 8032, for down-sampled subelement process after confusion region in be currently needed for fuzzy picture
Vegetarian refreshments region is sampled process.
To strengthen image processing effect, described device may also include model sense enhancement unit 807, to image
Manage to strengthen the model sense of described image.For example, model sense enhancement unit 807 can carry out brightness, saturation, right to entire image
Than image border enhancement process in degree adjustment and circle of good definition, in being embodied as, can as needed, using one of which or
Various ways.Related brightness, saturation, setting contrast and edge enhancement process technology are quite ripe, relevant real
Here is omitted for existing method.
In being embodied as, model sense enhancement unit 807 can be in advance processed image before Fuzzy Processing, it is also possible to
After the completion of Fuzzy Processing image processed again.
Although present disclosure is as above, the present invention is not limited to this.Any those skilled in the art, without departing from this
In the spirit and scope of invention, can make various changes or modifications, therefore protection scope of the present invention should be with claim institute
The scope of restriction is defined.